pub trait CacheBase {
Show 13 methods
// Required methods
fn db(&mut self, db: i8) -> &mut Self;
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) -> bool;
fn get_message_queue(&mut self, key: &str) -> JsonValue;
fn set_object(&mut self, key: &str, field: &str, value: JsonValue) -> bool;
fn get_object(&mut self, key: &str) -> JsonValue;
}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 秒
sourcefn set_message_queue(&mut self, key: &str, value: JsonValue) -> bool
fn set_message_queue(&mut self, key: &str, value: JsonValue) -> bool
设置消息队列
sourcefn get_message_queue(&mut self, key: &str) -> JsonValue
fn get_message_queue(&mut self, key: &str) -> JsonValue
获取消息队列
fn set_object(&mut self, key: &str, field: &str, value: JsonValue) -> bool
sourcefn get_object(&mut self, key: &str) -> JsonValue
fn get_object(&mut self, key: &str) -> JsonValue
获取哈希值
Object Safety§
This trait is not object safe.