pub enum Cache {
Redis(Redis),
None,
}Variants§
Implementations§
Source§impl Cache
impl Cache
Sourcepub fn create(name: &str, connection: Connection) -> Self
pub fn create(name: &str, connection: Connection) -> Self
非配置文件模式
Sourcepub fn connections(&mut self) -> JsonValue
pub fn connections(&mut self) -> JsonValue
获取通道列表
Sourcepub fn connection(&mut self, name: &str) -> Self
pub fn connection(&mut self, name: &str) -> Self
切换通道
Source§impl Cache
impl Cache
pub fn db(&mut self, db: i8) -> &mut Self
pub fn key_exists(&mut self, key: &str) -> Result<bool, String>
pub fn key_del(&mut self, key: &str) -> Result<bool, String>
pub fn key_ttl(&mut self, key: &str) -> Result<i64, String>
pub fn key_set_expireat( &mut self, key: &str, timestamp: i64, ) -> Result<bool, String>
pub fn key_set_seconds(&mut self, key: &str, s: i64) -> Result<bool, String>
pub fn key_del_expire(&mut self, key: &str) -> Result<bool, String>
pub fn key_query(&mut self, key: &str) -> Result<JsonValue, String>
pub fn add( &mut self, key: &str, value: JsonValue, expiration_date: u64, ) -> Result<bool, String>
pub fn get(&mut self, key: &str) -> Result<JsonValue, String>
pub fn set_add( &mut self, key: &str, value: JsonValue, expiry_s: i64, ) -> Result<bool, String>
pub fn set_count(&mut self, key: &str) -> Result<usize, String>
pub fn set_get(&mut self, key: &str) -> Result<JsonValue, String>
pub fn set_delete( &mut self, key: &str, value: JsonValue, ) -> Result<bool, String>
pub fn set_get_sinter(&mut self, keys: Vec<&str>) -> Result<JsonValue, String>
pub fn set_get_sunion(&mut self, keys: Vec<&str>) -> Result<JsonValue, String>
pub fn list_add( &mut self, key: &str, value: JsonValue, expiry_s: i64, ) -> Result<bool, String>
pub fn list_del(&mut self, key: &str, value: JsonValue) -> Result<bool, String>
Sourcepub fn list_lpush(
&mut self,
key: &str,
value: JsonValue,
expiry_s: i64,
) -> Result<bool, String>
pub fn list_lpush( &mut self, key: &str, value: JsonValue, expiry_s: i64, ) -> Result<bool, String>
从列表左侧添加元素
Sourcepub fn list_rpush(
&mut self,
key: &str,
value: JsonValue,
expiry_s: i64,
) -> Result<bool, String>
pub fn list_rpush( &mut self, key: &str, value: JsonValue, expiry_s: i64, ) -> Result<bool, String>
从列表右侧添加元素
Sourcepub fn list_lpop(
&mut self,
key: &str,
count: usize,
) -> Result<Vec<JsonValue>, String>
pub fn list_lpop( &mut self, key: &str, count: usize, ) -> Result<Vec<JsonValue>, String>
从列表左侧弹出多个元素
Sourcepub fn list_rpop(
&mut self,
key: &str,
count: usize,
) -> Result<Vec<JsonValue>, String>
pub fn list_rpop( &mut self, key: &str, count: usize, ) -> Result<Vec<JsonValue>, String>
从列表右侧弹出多个元素
Sourcepub fn list_range(
&mut self,
key: &str,
start: isize,
stop: isize,
) -> Result<Vec<JsonValue>, String>
pub fn list_range( &mut self, key: &str, start: isize, stop: isize, ) -> Result<Vec<JsonValue>, String>
获取列表指定范围的元素
Sourcepub fn list_get(&mut self, key: &str, index: isize) -> Result<JsonValue, String>
pub fn list_get(&mut self, key: &str, index: isize) -> Result<JsonValue, String>
根据索引获取列表元素(返回JsonValue)
Sourcepub fn list_trim(
&mut self,
key: &str,
start: isize,
stop: isize,
) -> Result<bool, String>
pub fn list_trim( &mut self, key: &str, start: isize, stop: isize, ) -> Result<bool, String>
修剪列表,只保留指定范围内的元素
Sourcepub fn list_set(
&mut self,
key: &str,
index: isize,
value: JsonValue,
) -> Result<bool, String>
pub fn list_set( &mut self, key: &str, index: isize, value: JsonValue, ) -> Result<bool, String>
设置指定索引位置的元素值
Sourcepub fn list_remove(
&mut self,
key: &str,
value: JsonValue,
count: isize,
) -> Result<isize, String>
pub fn list_remove( &mut self, key: &str, value: JsonValue, count: isize, ) -> Result<isize, String>
删除列表中指定值的元素
Sourcepub fn hash_add(
&mut self,
key: &str,
field: &str,
value: JsonValue,
) -> Result<bool, String>
pub fn hash_add( &mut self, key: &str, field: &str, value: JsonValue, ) -> Result<bool, String>
哈希 添加
Sourcepub fn hash_get_field_value(
&mut self,
key: &str,
field: &str,
) -> Result<JsonValue, String>
pub fn hash_get_field_value( &mut self, key: &str, field: &str, ) -> Result<JsonValue, String>
哈希-获取指定字段的值
pub fn hash_delete(&mut self, key: &str, field: &str) -> Result<bool, String>
pub fn geo_add( &mut self, key: &str, longitude: f64, latitude: f64, value: JsonValue, ) -> Result<bool, String>
pub fn geo_get( &mut self, key: &str, value: JsonValue, ) -> Result<JsonValue, String>
pub fn geo_dist( &mut self, key: &str, value1: JsonValue, value2: JsonValue, ) -> Result<JsonValue, String>
pub fn geo_radius( &mut self, key: &str, value: JsonValue, radius: &str, ) -> Result<JsonValue, String>
pub fn stream_add( &mut self, key: &str, msg_id: &str, field: &str, value: JsonValue, ) -> Result<String, String>
pub fn stream_count(&mut self, key: &str) -> Result<usize, String>
pub fn stream_get(&mut self, key: &str) -> Result<JsonValue, String>
pub fn stream_del(&mut self, key: &str, id: &str) -> Result<bool, String>
pub fn stream_group_create( &mut self, key: &str, group: &str, ) -> Result<bool, String>
pub fn stream_group_add_user( &mut self, key: &str, group: &str, user: &str, ) -> Result<bool, String>
pub fn stream_group_del_user( &mut self, key: &str, group: &str, user: &str, ) -> Result<bool, String>
pub fn stream_group_del( &mut self, key: &str, group: &str, ) -> Result<bool, String>
pub fn stream_group_msg( &mut self, key: &str, group: &str, user: &str, ) -> Result<JsonValue, String>
pub fn stream_get_group( &mut self, key: &str, group: &str, ) -> Result<bool, String>
pub fn stream_get_stream(&mut self, key: &str) -> Result<JsonValue, String>
pub fn subscribe( &mut self, key: &str, tx: Sender<JsonValue>, ) -> Result<(), String>
pub fn publish(&mut self, key: &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