br_cache

Trait CacheBase

source
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§

source

fn db(&mut self, db: i8) -> &mut Self

选择数据库

source

fn add( &mut self, key: &str, value: JsonValue, expiration_date: u64, ) -> Result<bool, String>

设置缓存

  • expiration_date 过期时间 s 秒
source

fn get(&mut self, key: &str) -> Result<JsonValue, String>

获取缓存

source

fn delete(&mut self, key: &str) -> Result<bool, String>

删除缓存

source

fn exists(&mut self, key: &str) -> Result<bool, String>

exists 判断KEY是否存在

  • key 键
source

fn keys(&mut self, key: &str) -> Result<JsonValue, String>

查询 KEY

  • key 键 格式 * 或 *#### 模糊查询
source

fn set_add(&mut self, key: &str, value: JsonValue) -> Result<bool, String>

集合 添加

source

fn set_get(&mut self, key: &str) -> Result<JsonValue, String>

集合 获取

source

fn set_delete(&mut self, key: &str, value: JsonValue) -> Result<bool, String>

集合 删除

source

fn set_message_queue(&mut self, key: &str, value: JsonValue) -> bool

设置消息队列

source

fn get_message_queue(&mut self, key: &str) -> JsonValue

获取消息队列

source

fn set_object(&mut self, key: &str, field: &str, value: JsonValue) -> bool

source

fn get_object(&mut self, key: &str) -> JsonValue

获取哈希值

Object Safety§

This trait is not object safe.

Implementors§