pub trait CacheBase {
Show 18 methods
// Required methods
fn db(&mut self, db: i8) -> Result<&mut dyn CacheBase, String>;
fn add(
&mut self,
key: &str,
value: JsonValue,
expiration_date: u64,
) -> Result<bool, String>;
fn get(&mut self, key: &str) -> Result<JsonValue, String>;
fn delete(&mut self, key: &str) -> Result<bool, String>;
fn exists(&mut self, key: &str) -> Result<bool, String>;
fn keys(&mut self, key: &str) -> Result<JsonValue, String>;
fn set_add(&mut self, key: &str, value: JsonValue) -> Result<bool, String>;
fn set_get(&mut self, key: &str) -> Result<JsonValue, String>;
fn set_delete(
&mut self,
key: &str,
value: JsonValue,
) -> Result<bool, String>;
fn set_message_queue(
&mut self,
key: &str,
value: JsonValue,
) -> Result<bool, String>;
fn get_message_queue(&mut self, key: &str) -> Result<JsonValue, String>;
fn set_object(
&mut self,
key: &str,
field: &str,
value: JsonValue,
) -> Result<bool, String>;
fn get_object(&mut self, key: &str) -> Result<JsonValue, String>;
fn add_hash(
&mut self,
key: &str,
field: &str,
value: JsonValue,
) -> Result<bool, String>;
fn get_hash_field_value(
&mut self,
key: &str,
field: &str,
) -> Result<JsonValue, String>;
fn get_hash_fields(&mut self, key: &str) -> Result<JsonValue, String>;
fn delete_hash(&mut self, key: &str, field: &str) -> Result<bool, String>;
fn get_hash_values(&mut self, key: &str) -> Result<JsonValue, String>;
}Required Methods§
Sourcefn add(
&mut self,
key: &str,
value: JsonValue,
expiration_date: u64,
) -> Result<bool, String>
fn add( &mut self, key: &str, value: JsonValue, expiration_date: u64, ) -> Result<bool, String>
设置缓存
- expiration_date 过期时间 s 秒
fn set_object( &mut self, key: &str, field: &str, value: JsonValue, ) -> Result<bool, String>
Sourcefn add_hash(
&mut self,
key: &str,
field: &str,
value: JsonValue,
) -> Result<bool, String>
fn add_hash( &mut self, key: &str, field: &str, value: JsonValue, ) -> Result<bool, String>
添加哈希