pub enum Cache {
Redis(Redis),
None,
}Variants§
Implementations§
Source§impl Cache
impl Cache
pub fn new(config: Config) -> Result<Self, String>
Sourcepub fn login(
cache_mode: CacheMode,
host: &str,
port: &str,
pass: &str,
) -> Result<Self, String>
pub fn login( cache_mode: CacheMode, host: &str, port: &str, pass: &str, ) -> Result<Self, String>
登录缓存
pub fn db(&mut self, db: i8) -> &mut Self
Sourcepub fn add(
&mut self,
key: &str,
value: JsonValue,
expiration_date: u64,
) -> Result<bool, String>
pub fn add( &mut self, key: &str, value: JsonValue, expiration_date: u64, ) -> Result<bool, String>
设置缓存
- key
- value
- expiration_date 过期时间 秒
pub fn get(&mut self, key: &str) -> Result<JsonValue, String>
pub fn exists(&mut self, key: &str) -> Result<bool, String>
Sourcepub fn set_message_queue(
&mut self,
key: &str,
value: JsonValue,
) -> Result<bool, String>
pub fn set_message_queue( &mut self, key: &str, value: JsonValue, ) -> Result<bool, String>
设置消息队列
pub fn set_object( &mut self, key: &str, field: &str, value: JsonValue, ) -> Result<bool, String>
Sourcepub fn add_hash(
&mut self,
key: &str,
field: &str,
value: JsonValue,
) -> Result<bool, String>
pub fn add_hash( &mut self, key: &str, field: &str, value: JsonValue, ) -> Result<bool, String>
哈希-添加
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Cache
impl RefUnwindSafe for Cache
impl Send for Cache
impl Sync for Cache
impl Unpin for Cache
impl UnwindSafe for Cache
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more