pub struct RedisRocksdb { /* private fields */ }
Implementations§
Trait Implementations§
Source§impl KeyValue for RedisRocksdb
impl KeyValue for RedisRocksdb
Source§impl RedisList for RedisRocksdb
[see] (https://xindoo.blog.csdn.net/article/details/109150975)
ssdb没有实现list,只实现了queue
impl RedisList for RedisRocksdb
[see] (https://xindoo.blog.csdn.net/article/details/109150975) ssdb没有实现list,只实现了queue
redis中的list使用quicklist与ziplist实现
fn list_blpop<K: Bytes, V: Bytes>( &mut self, _key: &K, _timeout: i64, ) -> Result<V, RrError>
fn list_brpop<K: Bytes, V: Bytes>( &mut self, _key: &K, _timeout: i64, ) -> Result<V, RrError>
fn list_brpoplpush<K: Bytes, V: Bytes>( &mut self, _srckey: &K, _dstkey: &K, _timeout: i64, ) -> Result<V, RrError>
fn list_index<K: Bytes>(&self, key: &K, index: i32) -> Result<Vec<u8>, RrError>
Source§fn list_insert_before<K: Bytes, V: Bytes>(
&mut self,
key: &K,
pivot: &V,
value: &V,
) -> Result<i32, RrError>
fn list_insert_before<K: Bytes, V: Bytes>( &mut self, key: &K, pivot: &V, value: &V, ) -> Result<i32, RrError>
如果命令执行成功,返回插入操作完成之后,列表的长度。
如果没有找到指定元素 ,返回 -1 。
如果 key 不存在或为空列表,返回 0
Source§fn list_insert_after<K: Bytes, V: Bytes>(
&mut self,
key: &K,
pivot: &V,
value: &V,
) -> Result<i32, RrError>
fn list_insert_after<K: Bytes, V: Bytes>( &mut self, key: &K, pivot: &V, value: &V, ) -> Result<i32, RrError>
如果命令执行成功,返回插入操作完成之后,列表的长度。
如果没有找到指定元素 ,返回 -1 。
如果 key 不存在或为空列表,返回 0
fn list_len<K: Bytes>(&self, key: &K) -> Result<i32, RrError>
Source§fn list_pop_front<K: Bytes>(
&mut self,
key: &K,
) -> Result<Option<Vec<u8>>, RrError>
fn list_pop_front<K: Bytes>( &mut self, key: &K, ) -> Result<Option<Vec<u8>>, RrError>
对应redis的 lpop,由于lpop命名,不是很明确,所以改名
Source§fn list_push_front<K: Bytes, V: Bytes>(
&mut self,
key: &K,
value: &V,
) -> Result<i32, RrError>
fn list_push_front<K: Bytes, V: Bytes>( &mut self, key: &K, value: &V, ) -> Result<i32, RrError>
返回len of list
对应redis的lpush,由于lpush命名,不是很明确,所以改名
Source§fn list_push_front_exists<K: Bytes, V: Bytes>(
&mut self,
key: &K,
value: &V,
) -> Result<i32, RrError>
fn list_push_front_exists<K: Bytes, V: Bytes>( &mut self, key: &K, value: &V, ) -> Result<i32, RrError>
返回len of list,如果list不存在返回值为 0
对应redis的lpushx
Source§fn list_range<K: Bytes>(
&self,
key: &K,
start: i32,
stop: i32,
) -> Result<Vec<Vec<u8>>, RrError>
fn list_range<K: Bytes>( &self, key: &K, start: i32, stop: i32, ) -> Result<Vec<Vec<u8>>, RrError>
返回在range范围内的元素,所以start与stop可能会在list的下标之外。range是包含stop的
如果一个都没有找到,返回为len为0的Vec
0表示第一个元素
-1表示倒数第一个元素
-100 100表示从到数100个元素到第101个元素。如果这时list中只有3个元素,返回所有的值,因为这3个都在 range的范围之内
Source§fn list_rem<K: Bytes, V: Bytes>(
&mut self,
list_key: &K,
count: i32,
value: &V,
) -> Result<LenType, RrError>
fn list_rem<K: Bytes, V: Bytes>( &mut self, list_key: &K, count: i32, value: &V, ) -> Result<LenType, RrError>
返回值为删除的数量
COUNT 的值可以是以下几种:
count > 0 : 从表头开始向表尾搜索,移除与 VALUE 相等的元素,数量为 COUNT。
count < 0 : 从表尾开始向表头搜索,移除与 VALUE 相等的元素,数量为 COUNT 的绝对值。
count = 0 : 移除表中所有与 VALUE 相等的值
Source§fn list_trim<K: Bytes>(
&mut self,
_key: K,
_start: i32,
_stop: i32,
) -> Result<i32, RrError>
fn list_trim<K: Bytes>( &mut self, _key: K, _start: i32, _stop: i32, ) -> Result<i32, RrError>
保留指定区间内的元素,不在指定区间之内的元素都将被删除, 反回删除的元素数量
Source§fn list_set<K: Bytes, V: Bytes>(
&mut self,
key: &K,
index: i32,
value: &V,
) -> Result<Vec<u8>, RrError>
fn list_set<K: Bytes, V: Bytes>( &mut self, key: &K, index: i32, value: &V, ) -> Result<Vec<u8>, RrError>
index无效或list为空时,返回错误。其余返回原来的值
Source§fn list_pop_back<K: Bytes>(
&mut self,
key: &K,
) -> Result<Option<Vec<u8>>, RrError>
fn list_pop_back<K: Bytes>( &mut self, key: &K, ) -> Result<Option<Vec<u8>>, RrError>
移除列表的最后一个元素
Source§fn list_replace_back<K: Bytes, V: Bytes>(
&mut self,
_key: &K,
_dstkey: &K,
) -> Result<V, RrError>
fn list_replace_back<K: Bytes, V: Bytes>( &mut self, _key: &K, _dstkey: &K, ) -> Result<V, RrError>
移除列表的最后一个元素,并将该元素添加到另一个列表并返回
对应redis的rpoplpush
Source§fn list_push_back<K: Bytes, V: Bytes>(
&mut self,
key: &K,
value: &V,
) -> Result<i32, RrError>
fn list_push_back<K: Bytes, V: Bytes>( &mut self, key: &K, value: &V, ) -> Result<i32, RrError>
返回len of list
对应redis的rpush
Source§impl Stack for RedisRocksdb
impl Stack for RedisRocksdb
Source§fn index<K: Bytes>(&self, key: &K, _index: i64) -> Result<Vec<u8>, RrError>
fn index<K: Bytes>(&self, key: &K, _index: i64) -> Result<Vec<u8>, RrError>
get the index of data
Source§fn len<K: Bytes>(&self, _key: &K) -> Result<i64, RrError>
fn len<K: Bytes>(&self, _key: &K) -> Result<i64, RrError>
let of list, if the list do not exist return is -1
Source§fn push<K: Bytes, V: Bytes>(
&mut self,
_key: &K,
_value: &V,
) -> Result<i64, RrError>
fn push<K: Bytes, V: Bytes>( &mut self, _key: &K, _value: &V, ) -> Result<i64, RrError>
push a value to end, if the list do not exit, create it and push
fn pushs<K: Bytes, V: Bytes>( &mut self, _key: &K, _values: &[&V], ) -> Result<i64, RrError>
Source§fn push_exists<K: Bytes, V: Bytes>(
&mut self,
_key: &K,
_value: &V,
) -> Result<i64, RrError>
fn push_exists<K: Bytes, V: Bytes>( &mut self, _key: &K, _value: &V, ) -> Result<i64, RrError>
push a value if the list exist. if list do not exist, return -1 and do nothing
Source§fn range<K: Bytes>(
&self,
_key: &K,
_start: i64,
_stop: i64,
) -> Result<Vec<Vec<u8>>, RrError>
fn range<K: Bytes>( &self, _key: &K, _start: i64, _stop: i64, ) -> Result<Vec<Vec<u8>>, RrError>
返回在range范围内的元素,所以start与stop可能会在list的下标之外。range是包含stop的
如果一个都没有找到,返回为len为0的Vec
0表示第一个元素
-1表示倒数第一个元素
-100 100表示从到数100个元素到第101个元素。如果这时list中只有3个元素,返回所有的值,因为这3个都在 range的范围之内
Source§fn set<K: Bytes, V: Bytes>(
&mut self,
_key: &K,
_index: i64,
_value: &V,
) -> Result<Vec<u8>, RrError>
fn set<K: Bytes, V: Bytes>( &mut self, _key: &K, _index: i64, _value: &V, ) -> Result<Vec<u8>, RrError>
index invalid or list is empty,return error.
Source§fn pops<K: Bytes>(
&self,
_key: &K,
_amount: u64,
) -> Result<Vec<Vec<u8>>, RrError>
fn pops<K: Bytes>( &self, _key: &K, _amount: u64, ) -> Result<Vec<Vec<u8>>, RrError>
remove the value of end
Auto Trait Implementations§
impl !Freeze for RedisRocksdb
impl RefUnwindSafe for RedisRocksdb
impl Send for RedisRocksdb
impl Sync for RedisRocksdb
impl Unpin for RedisRocksdb
impl UnwindSafe for RedisRocksdb
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