pub struct RedisPipeline { /* private fields */ }Expand description
The delivery’s own buffer in the window: what a handler queues its Redis commands into.
Reached as Ctx<keys::Pipeline> on a .pipeline() subscription. It carries fred’s command
methods, each queueing the command and returning Ok(()) once it is queued: the command runs
after the handler has returned, and only if the delivery is acknowledged, so its reply is not
available inside the handler. A command queued before ack executes before that ack. The
window sends it; there is no method here that sends. For a command whose answer the handler needs now, take
Ctx<keys::FredPool>.
The buffer is created on the first queued command, so a delivery whose handler queues nothing costs the window nothing.
§Examples
use ruststream_fred::stream::prelude::*;
/// Records the order and acknowledges it in one round trip with the rest of the window.
#[subscriber(RedisStream::new("orders").group("workers"))]
async fn record(order: &Order, Ctx(pipeline): Ctx<keys::Pipeline>) -> HandlerOutcome {
if pipeline.hset("orders:by-id", (order.id.to_string(), "seen")).await.is_err() {
return HandlerOutcome::retry();
}
HandlerOutcome::ack()
}
fn app() -> RustStream {
RustStream::new(AppInfo::new("orders", "0.1.0")).with_broker(
RedisBroker::standalone("redis://localhost:6379"),
|b| {
b.include(record.pipeline());
},
)
}A mount site without .pipeline() has no round to hand out, so the mount does not compile:
use ruststream::prelude::*;
use ruststream::subscriber;
use ruststream_fred::context::keys;
use ruststream_fred::RedisStream;
#[subscriber(RedisStream::new("orders").group("workers"))]
async fn record(order: &Order, Ctx(pipeline): Ctx<keys::Pipeline>) -> HandlerOutcome {
let _ = (order, pipeline);
HandlerOutcome::ack()
}
fn app() -> RustStream {
RustStream::new(AppInfo::new("orders", "0.1.0")).with_broker(
ruststream_fred::RedisBroker::standalone("redis://localhost:6379"),
|b| {
b.include(record);
},
)
}Implementations§
Source§impl RedisPipeline
impl RedisPipeline
Sourcepub async fn randomkey(&self) -> Result<(), Error>
pub async fn randomkey(&self) -> Result<(), Error>
Return a random key from the currently selected database.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn copy<S, D>(
&self,
source: S,
destination: D,
db: Option<u8>,
replace: bool,
) -> Result<(), Error>
pub async fn copy<S, D>( &self, source: S, destination: D, db: Option<u8>, replace: bool, ) -> Result<(), Error>
This command copies the value stored at the source key to the destination key.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn dump<K>(&self, key: K) -> Result<(), Error>
pub async fn dump<K>(&self, key: K) -> Result<(), Error>
Serialize the value stored at key in a Redis-specific format and return it as bulk string.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn type<K>(&self, key: K) -> Result<(), Error>
pub async fn type<K>(&self, key: K) -> Result<(), Error>
Returns the string representation of the type of the value stored at key.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn restore<K>(
&self,
key: K,
ttl: i64,
serialized: Value,
replace: bool,
absttl: bool,
idletime: Option<i64>,
frequency: Option<i64>,
) -> Result<(), Error>
pub async fn restore<K>( &self, key: K, ttl: i64, serialized: Value, replace: bool, absttl: bool, idletime: Option<i64>, frequency: Option<i64>, ) -> Result<(), Error>
Create a key associated with a value that is obtained by deserializing the provided serialized value
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn set<K, V>(
&self,
key: K,
value: V,
expire: Option<Expiration>,
options: Option<SetOptions>,
get: bool,
) -> Result<(), Error>
pub async fn set<K, V>( &self, key: K, value: V, expire: Option<Expiration>, options: Option<SetOptions>, get: bool, ) -> Result<(), Error>
Set a value with optional NX|XX, EX|PX|EXAT|PXAT|KEEPTTL, and GET arguments.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn setnx<K, V>(&self, key: K, value: V) -> Result<(), Error>
pub async fn setnx<K, V>(&self, key: K, value: V) -> Result<(), Error>
Sets key to value if key does not exist.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn get<K>(&self, key: K) -> Result<(), Error>
pub async fn get<K>(&self, key: K) -> Result<(), Error>
Read a value from the server.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn getrange<K>(
&self,
key: K,
start: usize,
end: usize,
) -> Result<(), Error>
pub async fn getrange<K>( &self, key: K, start: usize, end: usize, ) -> Result<(), Error>
Returns the substring of the string value stored at key with offsets start and end (both inclusive).
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn setrange<K, V>(
&self,
key: K,
offset: u32,
value: V,
) -> Result<(), Error>
pub async fn setrange<K, V>( &self, key: K, offset: u32, value: V, ) -> Result<(), Error>
Overwrites part of the string stored at key, starting at the specified offset, for the entire length of value.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn getset<K, V>(&self, key: K, value: V) -> Result<(), Error>
pub async fn getset<K, V>(&self, key: K, value: V) -> Result<(), Error>
Atomically sets key to value and returns the old value stored at key.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn getdel<K>(&self, key: K) -> Result<(), Error>
pub async fn getdel<K>(&self, key: K) -> Result<(), Error>
Get the value of key and delete the key.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn strlen<K>(&self, key: K) -> Result<(), Error>
pub async fn strlen<K>(&self, key: K) -> Result<(), Error>
Returns the length of the string value stored at key.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn del<K>(&self, keys: K) -> Result<(), Error>
pub async fn del<K>(&self, keys: K) -> Result<(), Error>
Removes the specified keys.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn unlink<K>(&self, keys: K) -> Result<(), Error>
pub async fn unlink<K>(&self, keys: K) -> Result<(), Error>
Unlinks the specified keys.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn rename<S, D>(&self, source: S, destination: D) -> Result<(), Error>
pub async fn rename<S, D>(&self, source: S, destination: D) -> Result<(), Error>
Renames source key to destination.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn renamenx<S, D>(
&self,
source: S,
destination: D,
) -> Result<(), Error>
pub async fn renamenx<S, D>( &self, source: S, destination: D, ) -> Result<(), Error>
Renames source key to destination if destination does not yet exist.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn append<K, V>(&self, key: K, value: V) -> Result<(), Error>
pub async fn append<K, V>(&self, key: K, value: V) -> Result<(), Error>
Append value to key if it’s a string.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn mget<K>(&self, keys: K) -> Result<(), Error>
pub async fn mget<K>(&self, keys: K) -> Result<(), Error>
Returns the values of all specified keys.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn mset<V>(&self, values: V) -> Result<(), Error>
pub async fn mset<V>(&self, values: V) -> Result<(), Error>
Sets the given keys to their respective values.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn msetnx<V>(&self, values: V) -> Result<(), Error>
pub async fn msetnx<V>(&self, values: V) -> Result<(), Error>
Sets the given keys to their respective values.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn incr<K>(&self, key: K) -> Result<(), Error>
pub async fn incr<K>(&self, key: K) -> Result<(), Error>
Increments the number stored at key by one.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn incr_by<K>(&self, key: K, val: i64) -> Result<(), Error>
pub async fn incr_by<K>(&self, key: K, val: i64) -> Result<(), Error>
Increments the number stored at key by val.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn incr_by_float<K>(&self, key: K, val: f64) -> Result<(), Error>
pub async fn incr_by_float<K>(&self, key: K, val: f64) -> Result<(), Error>
Increment the string representing a floating point number stored at key by val.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn decr<K>(&self, key: K) -> Result<(), Error>
pub async fn decr<K>(&self, key: K) -> Result<(), Error>
Decrements the number stored at key by one.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn decr_by<K>(&self, key: K, val: i64) -> Result<(), Error>
pub async fn decr_by<K>(&self, key: K, val: i64) -> Result<(), Error>
Decrements the number stored at key by val.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn ttl<K>(&self, key: K) -> Result<(), Error>
pub async fn ttl<K>(&self, key: K) -> Result<(), Error>
Returns the remaining time to live of a key that has a timeout, in seconds.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn pttl<K>(&self, key: K) -> Result<(), Error>
pub async fn pttl<K>(&self, key: K) -> Result<(), Error>
Returns the remaining time to live of a key that has a timeout, in milliseconds.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn persist<K>(&self, key: K) -> Result<(), Error>
pub async fn persist<K>(&self, key: K) -> Result<(), Error>
Remove the existing timeout on a key, turning the key from volatile (a key with an expiration) to persistent (a key that will never expire as no timeout is associated).
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn expire<K>(
&self,
key: K,
seconds: i64,
options: Option<ExpireOptions>,
) -> Result<(), Error>
pub async fn expire<K>( &self, key: K, seconds: i64, options: Option<ExpireOptions>, ) -> Result<(), Error>
Set a timeout on key.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn expire_at<K>(
&self,
key: K,
timestamp: i64,
options: Option<ExpireOptions>,
) -> Result<(), Error>
pub async fn expire_at<K>( &self, key: K, timestamp: i64, options: Option<ExpireOptions>, ) -> Result<(), Error>
Set a timeout on a key based on a UNIX timestamp.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn expire_time<K>(&self, key: K) -> Result<(), Error>
pub async fn expire_time<K>(&self, key: K) -> Result<(), Error>
Returns the absolute Unix timestamp (since January 1, 1970) in seconds at which the given key will expire.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn pexpire<K>(
&self,
key: K,
milliseconds: i64,
options: Option<ExpireOptions>,
) -> Result<(), Error>
pub async fn pexpire<K>( &self, key: K, milliseconds: i64, options: Option<ExpireOptions>, ) -> Result<(), Error>
This command works exactly like EXPIRE but the time to live of the key is specified in milliseconds instead of seconds.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn pexpire_at<K>(
&self,
key: K,
timestamp: i64,
options: Option<ExpireOptions>,
) -> Result<(), Error>
pub async fn pexpire_at<K>( &self, key: K, timestamp: i64, options: Option<ExpireOptions>, ) -> Result<(), Error>
PEXPIREAT has the same effect and semantic as EXPIREAT, but the Unix time at which the key will expire is specified in milliseconds instead of seconds.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn pexpire_time<K>(&self, key: K) -> Result<(), Error>
pub async fn pexpire_time<K>(&self, key: K) -> Result<(), Error>
PEXPIRETIME has the same semantic as EXPIRETIME, but returns the absolute Unix expiration timestamp in milliseconds instead of seconds.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn exists<K>(&self, keys: K) -> Result<(), Error>
pub async fn exists<K>(&self, keys: K) -> Result<(), Error>
Returns number of keys that exist from the keys arguments.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn hgetall<K>(&self, key: K) -> Result<(), Error>
pub async fn hgetall<K>(&self, key: K) -> Result<(), Error>
Returns all fields and values of the hash stored at key.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn hdel<K, F>(&self, key: K, fields: F) -> Result<(), Error>
pub async fn hdel<K, F>(&self, key: K, fields: F) -> Result<(), Error>
Removes the specified fields from the hash stored at key.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn hexists<K, F>(&self, key: K, field: F) -> Result<(), Error>
pub async fn hexists<K, F>(&self, key: K, field: F) -> Result<(), Error>
Returns if field is an existing field in the hash stored at key.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn hget<K, F>(&self, key: K, field: F) -> Result<(), Error>
pub async fn hget<K, F>(&self, key: K, field: F) -> Result<(), Error>
Returns the value associated with field in the hash stored at key.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn hincrby<K, F>(
&self,
key: K,
field: F,
increment: i64,
) -> Result<(), Error>
pub async fn hincrby<K, F>( &self, key: K, field: F, increment: i64, ) -> Result<(), Error>
Increments the number stored at field in the hash stored at key by increment.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn hincrbyfloat<K, F>(
&self,
key: K,
field: F,
increment: f64,
) -> Result<(), Error>
pub async fn hincrbyfloat<K, F>( &self, key: K, field: F, increment: f64, ) -> Result<(), Error>
Increment the specified field of a hash stored at key, and representing a floating point number, by the specified increment.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn hkeys<K>(&self, key: K) -> Result<(), Error>
pub async fn hkeys<K>(&self, key: K) -> Result<(), Error>
Returns all field names in the hash stored at key.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn hlen<K>(&self, key: K) -> Result<(), Error>
pub async fn hlen<K>(&self, key: K) -> Result<(), Error>
Returns the number of fields contained in the hash stored at key.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn hmget<K, F>(&self, key: K, fields: F) -> Result<(), Error>
pub async fn hmget<K, F>(&self, key: K, fields: F) -> Result<(), Error>
Returns the values associated with the specified fields in the hash stored at key.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn hmset<K, V>(&self, key: K, values: V) -> Result<(), Error>
pub async fn hmset<K, V>(&self, key: K, values: V) -> Result<(), Error>
Sets the specified fields to their respective values in the hash stored at key.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn hset<K, V>(&self, key: K, values: V) -> Result<(), Error>
pub async fn hset<K, V>(&self, key: K, values: V) -> Result<(), Error>
Sets fields in the hash stored at key to their provided values.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn hsetnx<K, F, V>(
&self,
key: K,
field: F,
value: V,
) -> Result<(), Error>
pub async fn hsetnx<K, F, V>( &self, key: K, field: F, value: V, ) -> Result<(), Error>
Sets field in the hash stored at key to value, only if field does not yet exist.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn hrandfield<K>(
&self,
key: K,
count: Option<(i64, bool)>,
) -> Result<(), Error>
pub async fn hrandfield<K>( &self, key: K, count: Option<(i64, bool)>, ) -> Result<(), Error>
When called with just the key argument, return a random field from the hash value stored at key.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn hstrlen<K, F>(&self, key: K, field: F) -> Result<(), Error>
pub async fn hstrlen<K, F>(&self, key: K, field: F) -> Result<(), Error>
Returns the string length of the value associated with field in the hash stored at key.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn hvals<K>(&self, key: K) -> Result<(), Error>
pub async fn hvals<K>(&self, key: K) -> Result<(), Error>
Returns all values in the hash stored at key.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn lmpop<K>(
&self,
keys: K,
direction: LMoveDirection,
count: Option<i64>,
) -> Result<(), Error>
pub async fn lmpop<K>( &self, keys: K, direction: LMoveDirection, count: Option<i64>, ) -> Result<(), Error>
Pops one or more elements from the first non-empty list key from the list of provided key names.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn lindex<K>(&self, key: K, index: i64) -> Result<(), Error>
pub async fn lindex<K>(&self, key: K, index: i64) -> Result<(), Error>
Returns the element at index in the list stored at key.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn linsert<K, P, V>(
&self,
key: K,
location: ListLocation,
pivot: P,
element: V,
) -> Result<(), Error>
pub async fn linsert<K, P, V>( &self, key: K, location: ListLocation, pivot: P, element: V, ) -> Result<(), Error>
Inserts element in the list stored at key either before or after the reference value pivot.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn llen<K>(&self, key: K) -> Result<(), Error>
pub async fn llen<K>(&self, key: K) -> Result<(), Error>
Returns the length of the list stored at key.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn lpop<K>(&self, key: K, count: Option<usize>) -> Result<(), Error>
pub async fn lpop<K>(&self, key: K, count: Option<usize>) -> Result<(), Error>
Removes and returns the first elements of the list stored at key.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn lpos<K, V>(
&self,
key: K,
element: V,
rank: Option<i64>,
count: Option<i64>,
maxlen: Option<i64>,
) -> Result<(), Error>
pub async fn lpos<K, V>( &self, key: K, element: V, rank: Option<i64>, count: Option<i64>, maxlen: Option<i64>, ) -> Result<(), Error>
The command returns the index of matching elements inside a Redis list.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn lpush<K, V>(&self, key: K, elements: V) -> Result<(), Error>
pub async fn lpush<K, V>(&self, key: K, elements: V) -> Result<(), Error>
Insert all the specified values at the head of the list stored at key.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn lpushx<K, V>(&self, key: K, elements: V) -> Result<(), Error>
pub async fn lpushx<K, V>(&self, key: K, elements: V) -> Result<(), Error>
Inserts specified values at the head of the list stored at key, only if key already exists and holds a list.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn lrange<K>(
&self,
key: K,
start: i64,
stop: i64,
) -> Result<(), Error>
pub async fn lrange<K>( &self, key: K, start: i64, stop: i64, ) -> Result<(), Error>
Returns the specified elements of the list stored at key.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn lrem<K, V>(
&self,
key: K,
count: i64,
element: V,
) -> Result<(), Error>
pub async fn lrem<K, V>( &self, key: K, count: i64, element: V, ) -> Result<(), Error>
Removes the first count occurrences of elements equal to element from the list stored at key.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn lset<K, V>(
&self,
key: K,
index: i64,
element: V,
) -> Result<(), Error>
pub async fn lset<K, V>( &self, key: K, index: i64, element: V, ) -> Result<(), Error>
Sets the list element at index to element.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn ltrim<K>(&self, key: K, start: i64, stop: i64) -> Result<(), Error>
pub async fn ltrim<K>(&self, key: K, start: i64, stop: i64) -> Result<(), Error>
Trim an existing list so that it will contain only the specified range of elements specified.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn rpop<K>(&self, key: K, count: Option<usize>) -> Result<(), Error>
pub async fn rpop<K>(&self, key: K, count: Option<usize>) -> Result<(), Error>
Removes and returns the last elements of the list stored at key.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn rpoplpush<S, D>(&self, source: S, dest: D) -> Result<(), Error>
pub async fn rpoplpush<S, D>(&self, source: S, dest: D) -> Result<(), Error>
Atomically returns and removes the last element (tail) of the list stored at source, and pushes the element at the first element (head) of the list stored at destination.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn lmove<S, D>(
&self,
source: S,
dest: D,
source_direction: LMoveDirection,
dest_direction: LMoveDirection,
) -> Result<(), Error>
pub async fn lmove<S, D>( &self, source: S, dest: D, source_direction: LMoveDirection, dest_direction: LMoveDirection, ) -> Result<(), Error>
Atomically returns and removes the first/last element (head/tail depending on the source direction argument) of the list stored at source, and pushes the element at the first/last element (head/tail depending on the destination direction argument) of the list stored at destination.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn rpush<K, V>(&self, key: K, elements: V) -> Result<(), Error>
pub async fn rpush<K, V>(&self, key: K, elements: V) -> Result<(), Error>
Insert all the specified values at the tail of the list stored at key.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn rpushx<K, V>(&self, key: K, elements: V) -> Result<(), Error>
pub async fn rpushx<K, V>(&self, key: K, elements: V) -> Result<(), Error>
Inserts specified values at the tail of the list stored at key, only if key already exists and holds a list.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn sort<K, S>(
&self,
key: K,
by: Option<Str>,
limit: Option<Limit>,
get: S,
order: Option<SortOrder>,
alpha: bool,
store: Option<Key>,
) -> Result<(), Error>
pub async fn sort<K, S>( &self, key: K, by: Option<Str>, limit: Option<Limit>, get: S, order: Option<SortOrder>, alpha: bool, store: Option<Key>, ) -> Result<(), Error>
Returns or stores the elements contained in the list, set or sorted set at key.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn sort_ro<K, S>(
&self,
key: K,
by: Option<Str>,
limit: Option<Limit>,
get: S,
order: Option<SortOrder>,
alpha: bool,
) -> Result<(), Error>
pub async fn sort_ro<K, S>( &self, key: K, by: Option<Str>, limit: Option<Limit>, get: S, order: Option<SortOrder>, alpha: bool, ) -> Result<(), Error>
Read-only variant of the SORT command.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn sadd<K, V>(&self, key: K, members: V) -> Result<(), Error>
pub async fn sadd<K, V>(&self, key: K, members: V) -> Result<(), Error>
Add the specified members to the set stored at key.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn scard<K>(&self, key: K) -> Result<(), Error>
pub async fn scard<K>(&self, key: K) -> Result<(), Error>
Returns the set cardinality (number of elements) of the set stored at key.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn sdiff<K>(&self, keys: K) -> Result<(), Error>
pub async fn sdiff<K>(&self, keys: K) -> Result<(), Error>
Returns the members of the set resulting from the difference between the first set and all the successive sets.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn sdiffstore<D, K>(&self, dest: D, keys: K) -> Result<(), Error>
pub async fn sdiffstore<D, K>(&self, dest: D, keys: K) -> Result<(), Error>
This command is equal to SDIFF, but instead of returning the resulting set, it is stored in destination.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn sinter<K>(&self, keys: K) -> Result<(), Error>
pub async fn sinter<K>(&self, keys: K) -> Result<(), Error>
Returns the members of the set resulting from the intersection of all the given sets.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn sinterstore<D, K>(&self, dest: D, keys: K) -> Result<(), Error>
pub async fn sinterstore<D, K>(&self, dest: D, keys: K) -> Result<(), Error>
This command is equal to SINTER, but instead of returning the resulting set, it is stored in destination.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn sismember<K, V>(&self, key: K, member: V) -> Result<(), Error>
pub async fn sismember<K, V>(&self, key: K, member: V) -> Result<(), Error>
Returns if member is a member of the set stored at key.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn smismember<K, V>(&self, key: K, members: V) -> Result<(), Error>
pub async fn smismember<K, V>(&self, key: K, members: V) -> Result<(), Error>
Returns whether each member is a member of the set stored at key.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn smembers<K>(&self, key: K) -> Result<(), Error>
pub async fn smembers<K>(&self, key: K) -> Result<(), Error>
Returns all the members of the set value stored at key.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn smove<S, D, V>(
&self,
source: S,
dest: D,
member: V,
) -> Result<(), Error>
pub async fn smove<S, D, V>( &self, source: S, dest: D, member: V, ) -> Result<(), Error>
Move member from the set at source to the set at destination.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn spop<K>(&self, key: K, count: Option<usize>) -> Result<(), Error>
pub async fn spop<K>(&self, key: K, count: Option<usize>) -> Result<(), Error>
Removes and returns one or more random members from the set value store at key.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn srandmember<K>(
&self,
key: K,
count: Option<usize>,
) -> Result<(), Error>
pub async fn srandmember<K>( &self, key: K, count: Option<usize>, ) -> Result<(), Error>
When called with just the key argument, return a random element from the set value stored at key.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn srem<K, V>(&self, key: K, members: V) -> Result<(), Error>
pub async fn srem<K, V>(&self, key: K, members: V) -> Result<(), Error>
Remove the specified members from the set stored at key.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn sunion<K>(&self, keys: K) -> Result<(), Error>
pub async fn sunion<K>(&self, keys: K) -> Result<(), Error>
Returns the members of the set resulting from the union of all the given sets.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn sunionstore<D, K>(&self, dest: D, keys: K) -> Result<(), Error>
pub async fn sunionstore<D, K>(&self, dest: D, keys: K) -> Result<(), Error>
This command is equal to SUNION, but instead of returning the resulting set, it is stored in destination.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn zadd<K, V>(
&self,
key: K,
options: Option<SetOptions>,
ordering: Option<Ordering>,
changed: bool,
incr: bool,
values: V,
) -> Result<(), Error>
pub async fn zadd<K, V>( &self, key: K, options: Option<SetOptions>, ordering: Option<Ordering>, changed: bool, incr: bool, values: V, ) -> Result<(), Error>
Adds all the specified members with the specified scores to the sorted set stored at key.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn zcard<K>(&self, key: K) -> Result<(), Error>
pub async fn zcard<K>(&self, key: K) -> Result<(), Error>
Returns the sorted set cardinality (number of elements) of the sorted set stored at key.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn zcount<K>(&self, key: K, min: f64, max: f64) -> Result<(), Error>
pub async fn zcount<K>(&self, key: K, min: f64, max: f64) -> Result<(), Error>
Returns the number of elements in the sorted set at key with a score between min and max.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn zdiff<K>(&self, keys: K, withscores: bool) -> Result<(), Error>
pub async fn zdiff<K>(&self, keys: K, withscores: bool) -> Result<(), Error>
This command is similar to ZDIFFSTORE, but instead of storing the resulting sorted set, it is returned to the client.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn zdiffstore<D, K>(&self, dest: D, keys: K) -> Result<(), Error>
pub async fn zdiffstore<D, K>(&self, dest: D, keys: K) -> Result<(), Error>
Computes the difference between the first and all successive input sorted sets and stores the result in destination.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn zincrby<K, V>(
&self,
key: K,
increment: f64,
member: V,
) -> Result<(), Error>
pub async fn zincrby<K, V>( &self, key: K, increment: f64, member: V, ) -> Result<(), Error>
Increments the score of member in the sorted set stored at key by increment.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn zinter<K, W>(
&self,
keys: K,
weights: W,
aggregate: Option<AggregateOptions>,
withscores: bool,
) -> Result<(), Error>
pub async fn zinter<K, W>( &self, keys: K, weights: W, aggregate: Option<AggregateOptions>, withscores: bool, ) -> Result<(), Error>
This command is similar to ZINTERSTORE, but instead of storing the resulting sorted set, it is returned to the client.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn zinterstore<D, K, W>(
&self,
dest: D,
keys: K,
weights: W,
aggregate: Option<AggregateOptions>,
) -> Result<(), Error>
pub async fn zinterstore<D, K, W>( &self, dest: D, keys: K, weights: W, aggregate: Option<AggregateOptions>, ) -> Result<(), Error>
Computes the intersection of the sorted sets given by the specified keys, and stores the result in destination.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn zlexcount<K, M, N>(
&self,
key: K,
min: M,
max: N,
) -> Result<(), Error>
pub async fn zlexcount<K, M, N>( &self, key: K, min: M, max: N, ) -> Result<(), Error>
When all the elements in a sorted set are inserted with the same score, in order to force lexicographical ordering, this command returns the number of elements in the sorted set at key with a value between min and max.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn zpopmax<K>(
&self,
key: K,
count: Option<usize>,
) -> Result<(), Error>
pub async fn zpopmax<K>( &self, key: K, count: Option<usize>, ) -> Result<(), Error>
Removes and returns up to count members with the highest scores in the sorted set stored at key.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn zpopmin<K>(
&self,
key: K,
count: Option<usize>,
) -> Result<(), Error>
pub async fn zpopmin<K>( &self, key: K, count: Option<usize>, ) -> Result<(), Error>
Removes and returns up to count members with the lowest scores in the sorted set stored at key.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn zmpop<K>(
&self,
keys: K,
sort: ZCmp,
count: Option<i64>,
) -> Result<(), Error>
pub async fn zmpop<K>( &self, keys: K, sort: ZCmp, count: Option<i64>, ) -> Result<(), Error>
Pops one or more elements, that are member-score pairs, from the first non-empty sorted set in the provided list of key names.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn zrandmember<K>(
&self,
key: K,
count: Option<(i64, bool)>,
) -> Result<(), Error>
pub async fn zrandmember<K>( &self, key: K, count: Option<(i64, bool)>, ) -> Result<(), Error>
When called with just the key argument, return a random element from the sorted set value stored at key.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn zrangestore<D, S, M, N>(
&self,
dest: D,
source: S,
min: M,
max: N,
sort: Option<ZSort>,
rev: bool,
limit: Option<Limit>,
) -> Result<(), Error>
pub async fn zrangestore<D, S, M, N>( &self, dest: D, source: S, min: M, max: N, sort: Option<ZSort>, rev: bool, limit: Option<Limit>, ) -> Result<(), Error>
This command is like ZRANGE, but stores the result in the destination key.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn zrange<K, M, N>(
&self,
key: K,
min: M,
max: N,
sort: Option<ZSort>,
rev: bool,
limit: Option<Limit>,
withscores: bool,
) -> Result<(), Error>
pub async fn zrange<K, M, N>( &self, key: K, min: M, max: N, sort: Option<ZSort>, rev: bool, limit: Option<Limit>, withscores: bool, ) -> Result<(), Error>
Returns the specified range of elements in the sorted set stored at key.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn zrangebylex<K, M, N>(
&self,
key: K,
min: M,
max: N,
limit: Option<Limit>,
) -> Result<(), Error>
pub async fn zrangebylex<K, M, N>( &self, key: K, min: M, max: N, limit: Option<Limit>, ) -> Result<(), Error>
When all the elements in a sorted set are inserted with the same score, in order to force lexicographical ordering, this command returns all the elements in the sorted set at key with a value between min and max.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn zrevrangebylex<K, M, N>(
&self,
key: K,
max: M,
min: N,
limit: Option<Limit>,
) -> Result<(), Error>
pub async fn zrevrangebylex<K, M, N>( &self, key: K, max: M, min: N, limit: Option<Limit>, ) -> Result<(), Error>
When all the elements in a sorted set are inserted with the same score, in order to force lexicographical ordering, this command returns all the elements in the sorted set at key with a value between max and min.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn zrangebyscore<K, M, N>(
&self,
key: K,
min: M,
max: N,
withscores: bool,
limit: Option<Limit>,
) -> Result<(), Error>
pub async fn zrangebyscore<K, M, N>( &self, key: K, min: M, max: N, withscores: bool, limit: Option<Limit>, ) -> Result<(), Error>
Returns all the elements in the sorted set at key with a score between min and max (including elements with score equal to min or max).
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn zrevrangebyscore<K, M, N>(
&self,
key: K,
max: M,
min: N,
withscores: bool,
limit: Option<Limit>,
) -> Result<(), Error>
pub async fn zrevrangebyscore<K, M, N>( &self, key: K, max: M, min: N, withscores: bool, limit: Option<Limit>, ) -> Result<(), Error>
Returns all the elements in the sorted set at key with a score between max and min (including elements with score equal to max or min).
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn zrank<K, V>(
&self,
key: K,
member: V,
withscore: bool,
) -> Result<(), Error>
pub async fn zrank<K, V>( &self, key: K, member: V, withscore: bool, ) -> Result<(), Error>
Returns the rank of member in the sorted set stored at key, with the scores ordered from low to high.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn zrem<K, V>(&self, key: K, members: V) -> Result<(), Error>
pub async fn zrem<K, V>(&self, key: K, members: V) -> Result<(), Error>
Removes the specified members from the sorted set stored at key.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn zremrangebylex<K, M, N>(
&self,
key: K,
min: M,
max: N,
) -> Result<(), Error>
pub async fn zremrangebylex<K, M, N>( &self, key: K, min: M, max: N, ) -> Result<(), Error>
When all the elements in a sorted set are inserted with the same score, in order to force lexicographical ordering, this command removes all elements in the sorted set stored at key between the lexicographical range specified by min and max.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn zremrangebyrank<K>(
&self,
key: K,
start: i64,
stop: i64,
) -> Result<(), Error>
pub async fn zremrangebyrank<K>( &self, key: K, start: i64, stop: i64, ) -> Result<(), Error>
Removes all elements in the sorted set stored at key with rank between start and stop.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn zremrangebyscore<K, M, N>(
&self,
key: K,
min: M,
max: N,
) -> Result<(), Error>
pub async fn zremrangebyscore<K, M, N>( &self, key: K, min: M, max: N, ) -> Result<(), Error>
Removes all elements in the sorted set stored at key with a score between min and max.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn zrevrange<K>(
&self,
key: K,
start: i64,
stop: i64,
withscores: bool,
) -> Result<(), Error>
pub async fn zrevrange<K>( &self, key: K, start: i64, stop: i64, withscores: bool, ) -> Result<(), Error>
Returns the specified range of elements in the sorted set stored at key.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn zrevrank<K, V>(
&self,
key: K,
member: V,
withscore: bool,
) -> Result<(), Error>
pub async fn zrevrank<K, V>( &self, key: K, member: V, withscore: bool, ) -> Result<(), Error>
Returns the rank of member in the sorted set stored at key, with the scores ordered from high to low.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn zscore<K, V>(&self, key: K, member: V) -> Result<(), Error>
pub async fn zscore<K, V>(&self, key: K, member: V) -> Result<(), Error>
Returns the score of member in the sorted set at key.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn zunion<K, W>(
&self,
keys: K,
weights: W,
aggregate: Option<AggregateOptions>,
withscores: bool,
) -> Result<(), Error>
pub async fn zunion<K, W>( &self, keys: K, weights: W, aggregate: Option<AggregateOptions>, withscores: bool, ) -> Result<(), Error>
This command is similar to ZUNIONSTORE, but instead of storing the resulting sorted set, it is returned to the client.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn zunionstore<D, K, W>(
&self,
dest: D,
keys: K,
weights: W,
aggregate: Option<AggregateOptions>,
) -> Result<(), Error>
pub async fn zunionstore<D, K, W>( &self, dest: D, keys: K, weights: W, aggregate: Option<AggregateOptions>, ) -> Result<(), Error>
Computes the union of the sorted sets given by the specified keys, and stores the result in destination.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn zmscore<K, V>(&self, key: K, members: V) -> Result<(), Error>
pub async fn zmscore<K, V>(&self, key: K, members: V) -> Result<(), Error>
Returns the scores associated with the specified members in the sorted set stored at key.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn xinfo_consumers<K, S>(
&self,
key: K,
groupname: S,
) -> Result<(), Error>
pub async fn xinfo_consumers<K, S>( &self, key: K, groupname: S, ) -> Result<(), Error>
This command returns the list of consumers that belong to the groupname consumer group of the stream stored at key.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn xinfo_groups<K>(&self, key: K) -> Result<(), Error>
pub async fn xinfo_groups<K>(&self, key: K) -> Result<(), Error>
This command returns the list of all consumers groups of the stream stored at key.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn xinfo_stream<K>(
&self,
key: K,
full: bool,
count: Option<u64>,
) -> Result<(), Error>
pub async fn xinfo_stream<K>( &self, key: K, full: bool, count: Option<u64>, ) -> Result<(), Error>
This command returns information about the stream stored at key.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn xadd<K, C, I, F>(
&self,
key: K,
nomkstream: bool,
cap: C,
id: I,
fields: F,
) -> Result<(), Error>
pub async fn xadd<K, C, I, F>( &self, key: K, nomkstream: bool, cap: C, id: I, fields: F, ) -> Result<(), Error>
Appends the specified stream entry to the stream at the specified key.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn xtrim<K, C>(&self, key: K, cap: C) -> Result<(), Error>
pub async fn xtrim<K, C>(&self, key: K, cap: C) -> Result<(), Error>
Trims the stream by evicting older entries (entries with lower IDs) if needed.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn xdel<K, S>(&self, key: K, ids: S) -> Result<(), Error>
pub async fn xdel<K, S>(&self, key: K, ids: S) -> Result<(), Error>
Removes the specified entries from a stream, and returns the number of entries deleted.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn xrange<K, S, E>(
&self,
key: K,
start: S,
end: E,
count: Option<u64>,
) -> Result<(), Error>
pub async fn xrange<K, S, E>( &self, key: K, start: S, end: E, count: Option<u64>, ) -> Result<(), Error>
The command returns the stream entries matching a given range of IDs.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn xrevrange<K, S, E>(
&self,
key: K,
end: E,
start: S,
count: Option<u64>,
) -> Result<(), Error>
pub async fn xrevrange<K, S, E>( &self, key: K, end: E, start: S, count: Option<u64>, ) -> Result<(), Error>
Similar to XRANGE, but with the results returned in reverse order.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn xlen<K>(&self, key: K) -> Result<(), Error>
pub async fn xlen<K>(&self, key: K) -> Result<(), Error>
Returns the number of entries inside a stream.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn xgroup_create<K, S, I>(
&self,
key: K,
groupname: S,
id: I,
mkstream: bool,
) -> Result<(), Error>
pub async fn xgroup_create<K, S, I>( &self, key: K, groupname: S, id: I, mkstream: bool, ) -> Result<(), Error>
This command creates a new consumer group uniquely identified by groupname for the stream stored at key.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn xgroup_createconsumer<K, G, C>(
&self,
key: K,
groupname: G,
consumername: C,
) -> Result<(), Error>
pub async fn xgroup_createconsumer<K, G, C>( &self, key: K, groupname: G, consumername: C, ) -> Result<(), Error>
Create a consumer named consumername in the consumer group groupname of the stream that’s stored at key.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn xgroup_delconsumer<K, G, C>(
&self,
key: K,
groupname: G,
consumername: C,
) -> Result<(), Error>
pub async fn xgroup_delconsumer<K, G, C>( &self, key: K, groupname: G, consumername: C, ) -> Result<(), Error>
Delete a consumer named consumername in the consumer group groupname of the stream that’s stored at key.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn xgroup_destroy<K, S>(
&self,
key: K,
groupname: S,
) -> Result<(), Error>
pub async fn xgroup_destroy<K, S>( &self, key: K, groupname: S, ) -> Result<(), Error>
Completely destroy a consumer group.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn xgroup_setid<K, S, I>(
&self,
key: K,
groupname: S,
id: I,
) -> Result<(), Error>
pub async fn xgroup_setid<K, S, I>( &self, key: K, groupname: S, id: I, ) -> Result<(), Error>
Set the last delivered ID for a consumer group.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn xack<K, G, I>(&self, key: K, group: G, ids: I) -> Result<(), Error>
pub async fn xack<K, G, I>(&self, key: K, group: G, ids: I) -> Result<(), Error>
Remove one or more messages from the Pending Entries List (PEL) of a stream consumer group.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn xclaim<K, G, C, I>(
&self,
key: K,
group: G,
consumer: C,
min_idle_time: u64,
ids: I,
idle: Option<u64>,
time: Option<u64>,
retry_count: Option<u64>,
force: bool,
justid: bool,
) -> Result<(), Error>
pub async fn xclaim<K, G, C, I>( &self, key: K, group: G, consumer: C, min_idle_time: u64, ids: I, idle: Option<u64>, time: Option<u64>, retry_count: Option<u64>, force: bool, justid: bool, ) -> Result<(), Error>
In the context of a stream consumer group, this command changes the ownership of a pending message, so that the new owner is the consumer specified as the command argument.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn xautoclaim<K, G, C, I>(
&self,
key: K,
group: G,
consumer: C,
min_idle_time: u64,
start: I,
count: Option<u64>,
justid: bool,
) -> Result<(), Error>
pub async fn xautoclaim<K, G, C, I>( &self, key: K, group: G, consumer: C, min_idle_time: u64, start: I, count: Option<u64>, justid: bool, ) -> Result<(), Error>
This command transfers ownership of pending stream entries that match the specified criteria.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn xpending<K, G, A>(
&self,
key: K,
group: G,
args: A,
) -> Result<(), Error>
pub async fn xpending<K, G, A>( &self, key: K, group: G, args: A, ) -> Result<(), Error>
Inspect the list of pending messages in a consumer group.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn fcall<F, K, V>(
&self,
func: F,
keys: K,
args: V,
) -> Result<(), Error>
pub async fn fcall<F, K, V>( &self, func: F, keys: K, args: V, ) -> Result<(), Error>
Invoke a function.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn fcall_ro<F, K, V>(
&self,
func: F,
keys: K,
args: V,
) -> Result<(), Error>
pub async fn fcall_ro<F, K, V>( &self, func: F, keys: K, args: V, ) -> Result<(), Error>
This is a read-only variant of the FCALL command that cannot execute commands that modify data.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn function_delete<S>(&self, library_name: S) -> Result<(), Error>
pub async fn function_delete<S>(&self, library_name: S) -> Result<(), Error>
Delete a library and all its functions.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn function_dump(&self) -> Result<(), Error>
pub async fn function_dump(&self) -> Result<(), Error>
Return the serialized payload of loaded libraries.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn function_flush(&self, async: bool) -> Result<(), Error>
pub async fn function_flush(&self, async: bool) -> Result<(), Error>
Deletes all the libraries.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn function_list<S>(
&self,
library_name: Option<S>,
withcode: bool,
) -> Result<(), Error>
pub async fn function_list<S>( &self, library_name: Option<S>, withcode: bool, ) -> Result<(), Error>
Return information about the functions and libraries.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn function_load<S>(
&self,
replace: bool,
code: S,
) -> Result<(), Error>
pub async fn function_load<S>( &self, replace: bool, code: S, ) -> Result<(), Error>
Load a library to Redis.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn function_restore<B, P>(
&self,
serialized: B,
policy: P,
) -> Result<(), Error>
pub async fn function_restore<B, P>( &self, serialized: B, policy: P, ) -> Result<(), Error>
Restore libraries from the serialized payload.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn function_stats(&self) -> Result<(), Error>
pub async fn function_stats(&self) -> Result<(), Error>
Return information about the function that’s currently running and information about the available execution engines.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn publish<S, V>(&self, channel: S, message: V) -> Result<(), Error>
pub async fn publish<S, V>(&self, channel: S, message: V) -> Result<(), Error>
Publish a message on the PubSub interface, returning the number of clients that received the message.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn spublish<S, V>(&self, channel: S, message: V) -> Result<(), Error>
pub async fn spublish<S, V>(&self, channel: S, message: V) -> Result<(), Error>
Posts a message to the given shard channel.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn pubsub_channels<S>(&self, pattern: S) -> Result<(), Error>
pub async fn pubsub_channels<S>(&self, pattern: S) -> Result<(), Error>
Lists the currently active channels.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn pubsub_numpat(&self) -> Result<(), Error>
pub async fn pubsub_numpat(&self) -> Result<(), Error>
Returns the number of unique patterns that are subscribed to by clients.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn pubsub_numsub<S>(&self, channels: S) -> Result<(), Error>
pub async fn pubsub_numsub<S>(&self, channels: S) -> Result<(), Error>
Returns the number of subscribers (exclusive of clients subscribed to patterns) for the specified channels.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn pubsub_shardchannels<S>(&self, pattern: S) -> Result<(), Error>
pub async fn pubsub_shardchannels<S>(&self, pattern: S) -> Result<(), Error>
Lists the currently active shard channels.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Sourcepub async fn pubsub_shardnumsub<S>(&self, channels: S) -> Result<(), Error>
pub async fn pubsub_shardnumsub<S>(&self, channels: S) -> Result<(), Error>
Returns the number of subscribers for the specified shard channels.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
Source§impl RedisPipeline
impl RedisPipeline
Sourcepub fn bind<'o, O>(&self, out: &'o O) -> &'o O
pub fn bind<'o, O>(&self, out: &'o O) -> &'o O
Binds a slot’s publisher to this delivery’s round, and hands the slot back.
What the slot publishes from this delivery’s handler is queued into the delivery’s segment
from then on: it leaves with the window, after what was queued before it, only if the
delivery is acknowledged, and under .atomic() inside the delivery’s MULTI / EXEC.
The slot keeps its codec and its transforms. A slot publish the handler does not bind
leaves at once.
See Bindable for a handler that binds its slot.
§Examples
use ruststream_fred::stream::prelude::*;
use serde::Serialize;
#[derive(Serialize, Outgoing)]
#[outgoing(name = "audit")]
struct Audit {
id: u64,
}
#[subscriber(RedisStream::new("orders").group("workers"))]
async fn record(
order: &Order,
Ctx(pipeline): Ctx<keys::Pipeline>,
Out(out): Out<impl Bindable>,
) -> HandlerOutcome {
// Queued into the delivery's segment: the audit entry leaves only with the `XACK`.
match pipeline.bind(out).message(&Audit { id: order.id }).publish().await {
Ok(()) => HandlerOutcome::ack(),
Err(_) => HandlerOutcome::retry(),
}
}Sourcepub async fn evalsha<S, K, V>(
&self,
hash: S,
keys: K,
args: V,
) -> Result<(), Error>
pub async fn evalsha<S, K, V>( &self, hash: S, keys: K, args: V, ) -> Result<(), Error>
Queues a Lua script run by its SHA1 digest (EVALSHA), with its keys and arguments.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged. On a cluster the command goes to the node of the first key.
§Errors
Returns fred’s error when the arguments do not convert, or when the delivery has already
settled.
§Examples
use ruststream_fred::stream::prelude::*;
/// The digest of a script the service loaded with `SCRIPT LOAD` at startup.
const MARK_SEEN: &str = "a42059b356c875f0717db19a51f6aaca9ae659ea";
#[subscriber(RedisStream::new("orders").group("workers"))]
async fn record(order: &Order, Ctx(pipeline): Ctx<keys::Pipeline>) -> HandlerOutcome {
let id = order.id.to_string();
match pipeline.evalsha(MARK_SEEN, vec!["orders:seen"], vec![id]).await {
Ok(()) => HandlerOutcome::ack(),
Err(_) => HandlerOutcome::retry(),
}
}Sourcepub async fn eval<S, K, V>(
&self,
script: S,
keys: K,
args: V,
) -> Result<(), Error>
pub async fn eval<S, K, V>( &self, script: S, keys: K, args: V, ) -> Result<(), Error>
Queues a Lua script run by its source (EVAL), with its keys and arguments.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged. On a cluster the command goes to the node of the first key.
§Errors
Returns fred’s error when the arguments do not convert, or when the delivery has already
settled.
§Examples
use ruststream_fred::stream::prelude::*;
const MARK_SEEN: &str = "return redis.call('SADD', KEYS[1], ARGV[1])";
#[subscriber(RedisStream::new("orders").group("workers"))]
async fn record(order: &Order, Ctx(pipeline): Ctx<keys::Pipeline>) -> HandlerOutcome {
let id = order.id.to_string();
match pipeline.eval(MARK_SEEN, vec!["orders:seen"], vec![id]).await {
Ok(()) => HandlerOutcome::ack(),
Err(_) => HandlerOutcome::retry(),
}
}Sourcepub async fn custom<T>(
&self,
command: CustomCommand,
args: Vec<T>,
) -> Result<(), Error>
pub async fn custom<T>( &self, command: CustomCommand, args: Vec<T>, ) -> Result<(), Error>
Queues a command this facade does not name, by its name and its arguments.
Queued into this delivery’s segment; it runs after the handler returns, when the delivery is acknowledged.
§Errors
Returns fred’s error when the arguments do not convert, or when the delivery has already
settled.
§Examples
use fred::types::{ClusterHash, CustomCommand};
use ruststream_fred::stream::prelude::*;
#[subscriber(RedisStream::new("orders").group("workers"))]
async fn record(order: &Order, Ctx(pipeline): Ctx<keys::Pipeline>) -> HandlerOutcome {
// Refreshes the order's last-access time, so an LRU eviction keeps it.
let touch = CustomCommand::new_static("TOUCH", ClusterHash::FirstKey, false);
match pipeline.custom(touch, vec![format!("order:{}", order.id)]).await {
Ok(()) => HandlerOutcome::ack(),
Err(_) => HandlerOutcome::retry(),
}
}Trait Implementations§
Source§impl Clone for RedisPipeline
impl Clone for RedisPipeline
Auto Trait Implementations§
impl !RefUnwindSafe for RedisPipeline
impl !UnwindSafe for RedisPipeline
impl Freeze for RedisPipeline
impl Send for RedisPipeline
impl Sync for RedisPipeline
impl Unpin for RedisPipeline
impl UnsafeUnpin for RedisPipeline
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more