classredis::RedisBatch
sys::Obj redis::RedisBatch
RedisBatch builds a list of commands that can be run in batch using pipeline or multi.
- del
Delete the given key value.
- each
Iterate the current commands in this batch.
- expire
This expire(Str key, Duration seconds)Expire given key after given
secondshas elasped, where timeout must be in even second intervals.- expireat
This expireat(Str key, DateTime timestamp)Expire given key when the given
timestamphas been reached, wheretimestamphas a resolution of whole seconds.- get
Get the value for given key.
- incr
Increments the number stored at key by one. If the key does not exist, it is set to 0 before performing the operation. If
pxis non-null expire this key after the given timeout in milliseconds. Returns the value of the key after the increment.- incrby
This incrby(Str key, Int delta)Increments the number stored at key by
delta. If the key does not exist, it is set to 0 before performing the operation. Ifpxis non-null expire this key after the given timeout in milliseconds. Returns the value of the key after the increment.- incrbyfloat
This incrbyfloat(Str key, Float delta)Increment the string representing a floating point number stored at
keyby the specifieddelta. If the key does not exist, it is set to 0 before performing the operation. Ifpxis non-null expire this key after the given timeout in milliseconds. Returns the value of the key after the increment.- llen
Return the length of the list stored at key. If key does not exist, it is interpreted as an empty list and 0 is returned.
- lpush
Insert all the specified values at the head of the list stored at key. If key does not exist, it is created as empty list before performing the push operations. When key holds a value that is not a list, throws Err.
Val may be a single value or a
Listof values. When aListis passed, all values are pushed in a single command. Note that values are pushed left-to-right, solpush(key, [1,2,3])results in3at the head.- lrange
This lrange(Str key, Int start := 0, Int stop := -1)Return the specified range of elements from the list stored at
key. Bothstartandstopare zero-based indexes. Use 0 and -1 to retrieve the entire list.- ltrim
This ltrim(Str key, Int start, Int stop)Trim an existing list so that it will contain only the specified range of elements specified. Both
startandstopare zero-based indexes, where 0 is the first element of the list (the head), 1 the next element and so on.- make
new make(|This? f := null)It-block ctor.
- pexpire
This pexpire(Str key, Duration milliseconds)Expire given key after given
mshas elasped, where timeout must be in even millisecond intervals.- rpush
Insert all the specified values at the tail of the list stored at key. If key does not exist, it is created as empty list before performing the push operation. When key holds a value that is not a list, throws Err.
Val may be a single value or a
Listof values. When aListis passed, all values are pushed in a single command.- set
This set(Str key, Obj? val, Duration? px := null)Set the given key to value, if
valis null this method deletes the given key (see del). Ifpxis non-null expire this key after the given timeout in milliseconds.- setnx
This setnx(Str key, Obj val, Duration? px := null)Set the given key to value only if key does not exist. Returns
trueif set was succesfull, or false if set failed due to already existing key. Ifpxis non-null expire this key after the given timeout in milliseconds.- size
Int size()Return number of commands in this batch.