pub struct AtomicCtx<'a> { /* private fields */ }Expand description
Handle passed to the atomic closure body. Methods mirror the
equivalent Store ops but operate on the already-held write
lock, so reads inside the block see the closure’s own writes.
Implementations§
Source§impl AtomicCtx<'_>
impl AtomicCtx<'_>
Sourcepub fn set(&mut self, key: &[u8], value: &[u8]) -> bool
pub fn set(&mut self, key: &[u8], value: &[u8]) -> bool
SET key value. Returns true (SET always succeeds without
NX/XX veto).
Sourcepub fn incr(&mut self, key: &[u8]) -> KevyResult<i64>
pub fn incr(&mut self, key: &[u8]) -> KevyResult<i64>
INCR key — by 1.
Sourcepub fn hset(
&mut self,
key: &[u8],
pairs: &[(&[u8], &[u8])],
) -> KevyResult<usize>
pub fn hset( &mut self, key: &[u8], pairs: &[(&[u8], &[u8])], ) -> KevyResult<usize>
HSET key field value.
Sourcepub fn hget(&mut self, key: &[u8], field: &[u8]) -> KevyResult<Option<Vec<u8>>>
pub fn hget(&mut self, key: &[u8], field: &[u8]) -> KevyResult<Option<Vec<u8>>>
HGET key field.
Sourcepub fn hincrby(
&mut self,
key: &[u8],
field: &[u8],
delta: i64,
) -> KevyResult<i64>
pub fn hincrby( &mut self, key: &[u8], field: &[u8], delta: i64, ) -> KevyResult<i64>
HINCRBY key field delta.
Sourcepub fn zadd(&mut self, key: &[u8], pairs: &[(f64, &[u8])]) -> KevyResult<usize>
pub fn zadd(&mut self, key: &[u8], pairs: &[(f64, &[u8])]) -> KevyResult<usize>
ZADD key score member.
Sourcepub fn zincrby(
&mut self,
key: &[u8],
delta: f64,
member: &[u8],
) -> KevyResult<f64>
pub fn zincrby( &mut self, key: &[u8], delta: f64, member: &[u8], ) -> KevyResult<f64>
ZINCRBY key delta member.
Sourcepub fn zscore(&mut self, key: &[u8], member: &[u8]) -> KevyResult<Option<f64>>
pub fn zscore(&mut self, key: &[u8], member: &[u8]) -> KevyResult<Option<f64>>
ZSCORE key member.
Sourcepub fn del(&mut self, keys: &[&[u8]]) -> usize
pub fn del(&mut self, keys: &[&[u8]]) -> usize
DEL key [key ...] — every key must hash to this shard.
Sourcepub fn exists(&mut self, keys: &[&[u8]]) -> usize
pub fn exists(&mut self, keys: &[&[u8]]) -> usize
EXISTS key [key ...] — count of the given keys that exist.
Sourcepub fn hdel(&mut self, key: &[u8], fields: &[&[u8]]) -> KevyResult<usize>
pub fn hdel(&mut self, key: &[u8], fields: &[&[u8]]) -> KevyResult<usize>
HDEL key field [field ...].
Sourcepub fn hgetall(&mut self, key: &[u8]) -> KevyResult<Vec<(Vec<u8>, Vec<u8>)>>
pub fn hgetall(&mut self, key: &[u8]) -> KevyResult<Vec<(Vec<u8>, Vec<u8>)>>
HGETALL key — (field, value) pairs; reads see the
closure’s own prior writes.
Sourcepub fn hmget(
&mut self,
key: &[u8],
fields: &[&[u8]],
) -> KevyResult<Vec<Option<Vec<u8>>>>
pub fn hmget( &mut self, key: &[u8], fields: &[&[u8]], ) -> KevyResult<Vec<Option<Vec<u8>>>>
HMGET key field [field ...] — None per absent field.
Sourcepub fn sadd(&mut self, key: &[u8], members: &[&[u8]]) -> KevyResult<usize>
pub fn sadd(&mut self, key: &[u8], members: &[&[u8]]) -> KevyResult<usize>
SADD key member [member ...].
Sourcepub fn srem(&mut self, key: &[u8], members: &[&[u8]]) -> KevyResult<usize>
pub fn srem(&mut self, key: &[u8], members: &[&[u8]]) -> KevyResult<usize>
SREM key member [member ...].
Sourcepub fn lpush(&mut self, key: &[u8], values: &[&[u8]]) -> KevyResult<usize>
pub fn lpush(&mut self, key: &[u8], values: &[&[u8]]) -> KevyResult<usize>
LPUSH key value [value ...] — returns the new list length.
Sourcepub fn rpush(&mut self, key: &[u8], values: &[&[u8]]) -> KevyResult<usize>
pub fn rpush(&mut self, key: &[u8], values: &[&[u8]]) -> KevyResult<usize>
RPUSH key value [value ...] — returns the new list length.
Sourcepub fn zrem(&mut self, key: &[u8], members: &[&[u8]]) -> KevyResult<usize>
pub fn zrem(&mut self, key: &[u8], members: &[&[u8]]) -> KevyResult<usize>
ZREM key member [member ...].
Sourcepub fn zcard(&mut self, key: &[u8]) -> KevyResult<usize>
pub fn zcard(&mut self, key: &[u8]) -> KevyResult<usize>
ZCARD key — member count; 0 when absent.
Sourcepub fn zadd_flags(
&mut self,
key: &[u8],
pairs: &[(f64, &[u8])],
flags: ZaddFlags,
) -> KevyResult<ZaddReport>
pub fn zadd_flags( &mut self, key: &[u8], pairs: &[(f64, &[u8])], flags: ZaddFlags, ) -> KevyResult<ZaddReport>
Flags-aware ZADD. AOF logs the applied pairs as plain
ZADD — the effect, never the condition (deterministic replay).
Sourcepub fn sismember(&mut self, key: &[u8], member: &[u8]) -> KevyResult<bool>
pub fn sismember(&mut self, key: &[u8], member: &[u8]) -> KevyResult<bool>
SISMEMBER key member.
Sourcepub fn lrange(
&mut self,
key: &[u8],
start: i64,
stop: i64,
) -> KevyResult<Vec<Vec<u8>>>
pub fn lrange( &mut self, key: &[u8], start: i64, stop: i64, ) -> KevyResult<Vec<Vec<u8>>>
LRANGE key start stop (inclusive, negatives count from the end).
Sourcepub fn llen(&mut self, key: &[u8]) -> KevyResult<usize>
pub fn llen(&mut self, key: &[u8]) -> KevyResult<usize>
LLEN key.
Sourcepub fn scard(&mut self, key: &[u8]) -> KevyResult<usize>
pub fn scard(&mut self, key: &[u8]) -> KevyResult<usize>
SCARD key.
Sourcepub fn zrangebyscore(
&mut self,
key: &[u8],
min: ScoreBound,
max: ScoreBound,
) -> KevyResult<Vec<(Vec<u8>, f64)>>
pub fn zrangebyscore( &mut self, key: &[u8], min: ScoreBound, max: ScoreBound, ) -> KevyResult<Vec<(Vec<u8>, f64)>>
ZRANGEBYSCORE key min max — (member, score) in score order.