Table of Contents

Interface IDatabaseAsync

Namespace
StackExchange.Redis
Assembly
StackExchange.Redis.StrongName.dll

Describes functionality that is common to both standalone redis servers and redis clusters

public interface IDatabaseAsync : IRedisAsync
Inherited Members

Methods

DebugObjectAsync(RedisKey, CommandFlags)

Returns the raw DEBUG OBJECT output for a key; this command is not fully documented and should be avoided unless you have good reason, and then avoided anyway.

Task<RedisValue> DebugObjectAsync(RedisKey key, CommandFlags flags = CommandFlags.None)

Parameters

key RedisKey
flags CommandFlags

Returns

Task<RedisValue>

Remarks

ExecuteAsync(string, ICollection<object>, CommandFlags)

Execute an arbitrary command against the server; this is primarily intended for executing modules, but may also be used to provide access to new features that lack a direct API

Task<RedisResult> ExecuteAsync(string command, ICollection<object> args, CommandFlags flags = CommandFlags.None)

Parameters

command string
args ICollection<object>
flags CommandFlags

Returns

Task<RedisResult>

A dynamic representation of the command's result

ExecuteAsync(string, params object[])

Execute an arbitrary command against the server; this is primarily intended for executing modules, but may also be used to provide access to new features that lack a direct API

Task<RedisResult> ExecuteAsync(string command, params object[] args)

Parameters

command string
args object[]

Returns

Task<RedisResult>

A dynamic representation of the command's result

GeoAddAsync(RedisKey, GeoEntry, CommandFlags)

Add the specified member to the set stored at key. Specified members that are already a member of this set are ignored. If key does not exist, a new set is created before adding the specified members.

Task<bool> GeoAddAsync(RedisKey key, GeoEntry value, CommandFlags flags = CommandFlags.None)

Parameters

key RedisKey
value GeoEntry
flags CommandFlags

Returns

Task<bool>

True if the specified member was not already present in the set, else False

Remarks

GeoAddAsync(RedisKey, GeoEntry[], CommandFlags)

Add the specified members to the set stored at key. Specified members that are already a member of this set are ignored. If key does not exist, a new set is created before adding the specified members.

Task<long> GeoAddAsync(RedisKey key, GeoEntry[] values, CommandFlags flags = CommandFlags.None)

Parameters

key RedisKey
values GeoEntry[]
flags CommandFlags

Returns

Task<long>

the number of elements that were added to the set, not including all the elements already present into the set.

Remarks

GeoAddAsync(RedisKey, double, double, RedisValue, CommandFlags)

Add the specified member to the set stored at key. Specified members that are already a member of this set are ignored. If key does not exist, a new set is created before adding the specified members.

Task<bool> GeoAddAsync(RedisKey key, double longitude, double latitude, RedisValue member, CommandFlags flags = CommandFlags.None)

Parameters

key RedisKey
longitude double
latitude double
member RedisValue
flags CommandFlags

Returns

Task<bool>

True if the specified member was not already present in the set, else False

Remarks

GeoDistanceAsync(RedisKey, RedisValue, RedisValue, GeoUnit, CommandFlags)

Return the distance between two members in the geospatial index represented by the sorted set.

Task<double?> GeoDistanceAsync(RedisKey key, RedisValue member1, RedisValue member2, GeoUnit unit = GeoUnit.Meters, CommandFlags flags = CommandFlags.None)

Parameters

key RedisKey
member1 RedisValue
member2 RedisValue
unit GeoUnit
flags CommandFlags

Returns

Task<double?>

The command returns the distance as a double (represented as a string) in the specified unit, or NULL if one or both the elements are missing.

Remarks

GeoHashAsync(RedisKey, RedisValue, CommandFlags)

Return valid Geohash strings representing the position of one or more elements in a sorted set value representing a geospatial index (where elements were added using GEOADD).

Task<string> GeoHashAsync(RedisKey key, RedisValue member, CommandFlags flags = CommandFlags.None)

Parameters

key RedisKey
member RedisValue
flags CommandFlags

Returns

Task<string>

The command returns an array where each element is the Geohash corresponding to each member name passed as argument to the command.

Remarks

GeoHashAsync(RedisKey, RedisValue[], CommandFlags)

Return valid Geohash strings representing the position of one or more elements in a sorted set value representing a geospatial index (where elements were added using GEOADD).

Task<string[]> GeoHashAsync(RedisKey key, RedisValue[] members, CommandFlags flags = CommandFlags.None)

Parameters

key RedisKey
members RedisValue[]
flags CommandFlags

Returns

Task<string[]>

The command returns an array where each element is the Geohash corresponding to each member name passed as argument to the command.

Remarks

GeoPositionAsync(RedisKey, RedisValue, CommandFlags)

Return the positions (longitude,latitude) of all the specified members of the geospatial index represented by the sorted set at key.

Task<GeoPosition?> GeoPositionAsync(RedisKey key, RedisValue member, CommandFlags flags = CommandFlags.None)

Parameters

key RedisKey
member RedisValue
flags CommandFlags

Returns

Task<GeoPosition?>

The command returns an array where each element is a two elements array representing longitude and latitude (x,y) of each member name passed as argument to the command.Non existing elements are reported as NULL elements of the array.

Remarks

GeoPositionAsync(RedisKey, RedisValue[], CommandFlags)

Return the positions (longitude,latitude) of all the specified members of the geospatial index represented by the sorted set at key.

Task<GeoPosition?[]> GeoPositionAsync(RedisKey key, RedisValue[] members, CommandFlags flags = CommandFlags.None)

Parameters

key RedisKey
members RedisValue[]
flags CommandFlags

Returns

Task<GeoPosition?[]>

The command returns an array where each element is a two elements array representing longitude and latitude (x,y) of each member name passed as argument to the command.Non existing elements are reported as NULL elements of the array.

Remarks

GeoRadiusAsync(RedisKey, RedisValue, double, GeoUnit, int, Order?, GeoRadiusOptions, CommandFlags)

Return the members of a sorted set populated with geospatial information using GEOADD, which are within the borders of the area specified with the center location and the maximum distance from the center (the radius).

Task<GeoRadiusResult[]> GeoRadiusAsync(RedisKey key, RedisValue member, double radius, GeoUnit unit = GeoUnit.Meters, int count = -1, Order? order = null, GeoRadiusOptions options = GeoRadiusOptions.Default, CommandFlags flags = CommandFlags.None)

Parameters

key RedisKey
member RedisValue
radius double
unit GeoUnit
count int
order Order?
options GeoRadiusOptions
flags CommandFlags

Returns

Task<GeoRadiusResult[]>

GeoRadiusResult[]

Remarks

GeoRadiusAsync(RedisKey, double, double, double, GeoUnit, int, Order?, GeoRadiusOptions, CommandFlags)

Return the members of a sorted set populated with geospatial information using GEOADD, which are within the borders of the area specified with the center location and the maximum distance from the center (the radius).

Task<GeoRadiusResult[]> GeoRadiusAsync(RedisKey key, double longitude, double latitude, double radius, GeoUnit unit = GeoUnit.Meters, int count = -1, Order? order = null, GeoRadiusOptions options = GeoRadiusOptions.Default, CommandFlags flags = CommandFlags.None)

Parameters

key RedisKey
longitude double
latitude double
radius double
unit GeoUnit
count int
order Order?
options GeoRadiusOptions
flags CommandFlags

Returns

Task<GeoRadiusResult[]>

GeoRadiusResult[]

Remarks

GeoRemoveAsync(RedisKey, RedisValue, CommandFlags)

Removes the specified member from the geo sorted set stored at key. Non existing members are ignored.

Task<bool> GeoRemoveAsync(RedisKey key, RedisValue member, CommandFlags flags = CommandFlags.None)

Parameters

key RedisKey
member RedisValue
flags CommandFlags

Returns

Task<bool>

True if the member existed in the sorted set and was removed; False otherwise.

Remarks

HashDecrementAsync(RedisKey, RedisValue, double, CommandFlags)

Decrement the specified field of an hash stored at key, and representing a floating point number, by the specified decrement. If the field does not exist, it is set to 0 before performing the operation.

Task<double> HashDecrementAsync(RedisKey key, RedisValue hashField, double value, CommandFlags flags = CommandFlags.None)

Parameters

key RedisKey
hashField RedisValue
value double
flags CommandFlags

Returns

Task<double>

the value at field after the decrement operation.

Remarks

The precision of the output is fixed at 17 digits after the decimal point regardless of the actual internal precision of the computation.

HashDecrementAsync(RedisKey, RedisValue, long, CommandFlags)

Increments the number stored at field in the hash stored at key by increment. If key does not exist, a new key holding a hash is created. If field does not exist or holds a string that cannot be interpreted as integer, the value is set to 0 before the operation is performed.

Task<long> HashDecrementAsync(RedisKey key, RedisValue hashField, long value = 1, CommandFlags flags = CommandFlags.None)

Parameters

key RedisKey
hashField RedisValue
value long
flags CommandFlags

Returns

Task<long>

the value at field after the increment operation.

Remarks

The range of values supported by HINCRBY is limited to 64 bit signed integers.

HashDeleteAsync(RedisKey, RedisValue, CommandFlags)

Removes the specified fields from the hash stored at key. Non-existing fields are ignored. Non-existing keys are treated as empty hashes and this command returns 0.

Task<bool> HashDeleteAsync(RedisKey key, RedisValue hashField, CommandFlags flags = CommandFlags.None)

Parameters

key RedisKey
hashField RedisValue
flags CommandFlags

Returns

Task<bool>

The number of fields that were removed.

Remarks

HashDeleteAsync(RedisKey, RedisValue[], CommandFlags)

Removes the specified fields from the hash stored at key. Non-existing fields are ignored. Non-existing keys are treated as empty hashes and this command returns 0.

Task<long> HashDeleteAsync(RedisKey key, RedisValue[] hashFields, CommandFlags flags = CommandFlags.None)

Parameters

key RedisKey
hashFields RedisValue[]
flags CommandFlags

Returns

Task<long>

The number of fields that were removed.

Remarks

HashExistsAsync(RedisKey, RedisValue, CommandFlags)

Returns if field is an existing field in the hash stored at key.

Task<bool> HashExistsAsync(RedisKey key, RedisValue hashField, CommandFlags flags = CommandFlags.None)

Parameters

key RedisKey
hashField RedisValue
flags CommandFlags

Returns

Task<bool>

1 if the hash contains field. 0 if the hash does not contain field, or key does not exist.

Remarks

HashGetAllAsync(RedisKey, CommandFlags)

Returns all fields and values of the hash stored at key.

Task<HashEntry[]> HashGetAllAsync(RedisKey key, CommandFlags flags = CommandFlags.None)

Parameters

key RedisKey
flags CommandFlags

Returns

Task<HashEntry[]>

list of fields and their values stored in the hash, or an empty list when key does not exist.

Remarks

HashGetAsync(RedisKey, RedisValue, CommandFlags)

Returns the value associated with field in the hash stored at key.

Task<RedisValue> HashGetAsync(RedisKey key, RedisValue hashField, CommandFlags flags = CommandFlags.None)

Parameters

key RedisKey
hashField RedisValue
flags CommandFlags

Returns

Task<RedisValue>

the value associated with field, or nil when field is not present in the hash or key does not exist.

Remarks

HashGetAsync(RedisKey, RedisValue[], CommandFlags)

Returns the values associated with the specified fields in the hash stored at key. For every field that does not exist in the hash, a nil value is returned.Because a non-existing keys are treated as empty hashes, running HMGET against a non-existing key will return a list of nil values.

Task<RedisValue[]> HashGetAsync(RedisKey key, RedisValue[] hashFields, CommandFlags flags = CommandFlags.None)

Parameters

key RedisKey
hashFields RedisValue[]
flags CommandFlags

Returns

Task<RedisValue[]>

list of values associated with the given fields, in the same order as they are requested.

Remarks

HashIncrementAsync(RedisKey, RedisValue, double, CommandFlags)

Increment the specified field of an hash stored at key, and representing a floating point number, by the specified increment. If the field does not exist, it is set to 0 before performing the operation.

Task<double> HashIncrementAsync(RedisKey key, RedisValue hashField, double value, CommandFlags flags = CommandFlags.None)

Parameters

key RedisKey
hashField RedisValue
value double
flags CommandFlags

Returns

Task<double>

the value at field after the increment operation.

Remarks

The precision of the output is fixed at 17 digits after the decimal point regardless of the actual internal precision of the computation.

HashIncrementAsync(RedisKey, RedisValue, long, CommandFlags)

Increments the number stored at field in the hash stored at key by increment. If key does not exist, a new key holding a hash is created. If field does not exist or holds a string that cannot be interpreted as integer, the value is set to 0 before the operation is performed.

Task<long> HashIncrementAsync(RedisKey key, RedisValue hashField, long value = 1, CommandFlags flags = CommandFlags.None)

Parameters

key RedisKey
hashField RedisValue
value long
flags CommandFlags

Returns

Task<long>

the value at field after the increment operation.

Remarks

The range of values supported by HINCRBY is limited to 64 bit signed integers.

HashKeysAsync(RedisKey, CommandFlags)

Returns all field names in the hash stored at key.

Task<RedisValue[]> HashKeysAsync(RedisKey key, CommandFlags flags = CommandFlags.None)

Parameters

key RedisKey
flags CommandFlags

Returns

Task<RedisValue[]>

list of fields in the hash, or an empty list when key does not exist.

Remarks

HashLengthAsync(RedisKey, CommandFlags)

Returns the number of fields contained in the hash stored at key.

Task<long> HashLengthAsync(RedisKey key, CommandFlags flags = CommandFlags.None)

Parameters

key RedisKey
flags CommandFlags

Returns

Task<long>

number of fields in the hash, or 0 when key does not exist.

Remarks

HashSetAsync(RedisKey, HashEntry[], CommandFlags)

Sets the specified fields to their respective values in the hash stored at key. This command overwrites any existing fields in the hash. If key does not exist, a new key holding a hash is created.

Task HashSetAsync(RedisKey key, HashEntry[] hashFields, CommandFlags flags = CommandFlags.None)

Parameters

key RedisKey
hashFields HashEntry[]
flags CommandFlags

Returns

Task

Remarks

HashSetAsync(RedisKey, RedisValue, RedisValue, When, CommandFlags)

Sets field in the hash stored at key to value. If key does not exist, a new key holding a hash is created. If field already exists in the hash, it is overwritten.

Task<bool> HashSetAsync(RedisKey key, RedisValue hashField, RedisValue value, When when = When.Always, CommandFlags flags = CommandFlags.None)

Parameters

key RedisKey
hashField RedisValue
value RedisValue
when When
flags CommandFlags

Returns

Task<bool>

1 if field is a new field in the hash and value was set. 0 if field already exists in the hash and the value was updated.

Remarks

HashValuesAsync(RedisKey, CommandFlags)

Returns all values in the hash stored at key.

Task<RedisValue[]> HashValuesAsync(RedisKey key, CommandFlags flags = CommandFlags.None)

Parameters

key RedisKey
flags CommandFlags

Returns

Task<RedisValue[]>

list of values in the hash, or an empty list when key does not exist.

Remarks

HyperLogLogAddAsync(RedisKey, RedisValue, CommandFlags)

Adds the element to the HyperLogLog data structure stored at the variable name specified as first argument.

Task<bool> HyperLogLogAddAsync(RedisKey key, RedisValue value, CommandFlags flags = CommandFlags.None)

Parameters

key RedisKey
value RedisValue
flags CommandFlags

Returns

Task<bool>

true if at least 1 HyperLogLog internal register was altered. false otherwise.

Remarks

HyperLogLogAddAsync(RedisKey, RedisValue[], CommandFlags)

Adds all the element arguments to the HyperLogLog data structure stored at the variable name specified as first argument.

Task<bool> HyperLogLogAddAsync(RedisKey key, RedisValue[] values, CommandFlags flags = CommandFlags.None)

Parameters

key RedisKey
values RedisValue[]
flags CommandFlags

Returns

Task<bool>

true if at least 1 HyperLogLog internal register was altered. false otherwise.

Remarks

HyperLogLogLengthAsync(RedisKey, CommandFlags)

Returns the approximated cardinality computed by the HyperLogLog data structure stored at the specified variable, or 0 if the variable does not exist.

Task<long> HyperLogLogLengthAsync(RedisKey key, CommandFlags flags = CommandFlags.None)

Parameters

key RedisKey
flags CommandFlags

Returns

Task<long>

The approximated number of unique elements observed via HyperLogLogAdd.

Remarks

HyperLogLogLengthAsync(RedisKey[], CommandFlags)

Returns the approximated cardinality of the union of the HyperLogLogs passed, by internally merging the HyperLogLogs stored at the provided keys into a temporary hyperLogLog, or 0 if the variable does not exist.

Task<long> HyperLogLogLengthAsync(RedisKey[] keys, CommandFlags flags = CommandFlags.None)

Parameters

keys RedisKey[]
flags CommandFlags

Returns

Task<long>

The approximated number of unique elements observed via HyperLogLogAdd.

Remarks

HyperLogLogMergeAsync(RedisKey, RedisKey, RedisKey, CommandFlags)

Merge multiple HyperLogLog values into an unique value that will approximate the cardinality of the union of the observed Sets of the source HyperLogLog structures.

Task HyperLogLogMergeAsync(RedisKey destination, RedisKey first, RedisKey second, CommandFlags flags = CommandFlags.None)

Parameters

destination RedisKey
first RedisKey
second RedisKey
flags CommandFlags

Returns

Task

Remarks

HyperLogLogMergeAsync(RedisKey, RedisKey[], CommandFlags)

Merge multiple HyperLogLog values into an unique value that will approximate the cardinality of the union of the observed Sets of the source HyperLogLog structures.

Task HyperLogLogMergeAsync(RedisKey destination, RedisKey[] sourceKeys, CommandFlags flags = CommandFlags.None)

Parameters

destination RedisKey
sourceKeys RedisKey[]
flags CommandFlags

Returns

Task

Remarks

IdentifyEndpointAsync(RedisKey, CommandFlags)

Inidicate exactly which redis server we are talking to

Task<EndPoint> IdentifyEndpointAsync(RedisKey key = default, CommandFlags flags = CommandFlags.None)

Parameters

key RedisKey
flags CommandFlags

Returns

Task<EndPoint>

IsConnected(RedisKey, CommandFlags)

Indicates whether the instance can communicate with the server (resolved using the supplied key and optional flags)

bool IsConnected(RedisKey key, CommandFlags flags = CommandFlags.None)

Parameters

key RedisKey
flags CommandFlags

Returns

bool

KeyDeleteAsync(RedisKey, CommandFlags)

Removes the specified key. A key is ignored if it does not exist.

Task<bool> KeyDeleteAsync(RedisKey key, CommandFlags flags = CommandFlags.None)

Parameters

key RedisKey
flags CommandFlags

Returns

Task<bool>

True if the key was removed.

Remarks

KeyDeleteAsync(RedisKey[], CommandFlags)

Removes the specified keys. A key is ignored if it does not exist.

Task<long> KeyDeleteAsync(RedisKey[] keys, CommandFlags flags = CommandFlags.None)

Parameters

keys RedisKey[]
flags CommandFlags

Returns

Task<long>

The number of keys that were removed.

Remarks

KeyDumpAsync(RedisKey, CommandFlags)

Serialize the value stored at key in a Redis-specific format and return it to the user. The returned value can be synthesized back into a Redis key using the RESTORE command.

Task<byte[]> KeyDumpAsync(RedisKey key, CommandFlags flags = CommandFlags.None)

Parameters

key RedisKey
flags CommandFlags

Returns

Task<byte[]>

the serialized value.

Remarks

KeyExistsAsync(RedisKey, CommandFlags)

Returns if key exists.

Task<bool> KeyExistsAsync(RedisKey key, CommandFlags flags = CommandFlags.None)

Parameters

key RedisKey
flags CommandFlags

Returns

Task<bool>

1 if the key exists. 0 if the key does not exist.

Remarks

KeyExpireAsync(RedisKey, DateTime?, CommandFlags)

Set a timeout on key. After the timeout has expired, the key will automatically be deleted. A key with an associated timeout is said to be volatile in Redis terminology.

Task<bool> KeyExpireAsync(RedisKey key, DateTime? expiry, CommandFlags flags = CommandFlags.None)

Parameters

key RedisKey
expiry DateTime?
flags CommandFlags

Returns

Task<bool>

1 if the timeout was set. 0 if key does not exist or the timeout could not be set.

Remarks

If key is updated before the timeout has expired, then the timeout is removed as if the PERSIST command was invoked on key. For Redis versions < 2.1.3, existing timeouts cannot be overwritten. So, if key already has an associated timeout, it will do nothing and return 0. Since Redis 2.1.3, you can update the timeout of a key. It is also possible to remove the timeout using the PERSIST command. See the page on key expiry for more information.

KeyExpireAsync(RedisKey, TimeSpan?, CommandFlags)

Set a timeout on key. After the timeout has expired, the key will automatically be deleted. A key with an associated timeout is said to be volatile in Redis terminology.

Task<bool> KeyExpireAsync(RedisKey key, TimeSpan? expiry, CommandFlags flags = CommandFlags.None)

Parameters

key RedisKey
expiry TimeSpan?
flags CommandFlags

Returns

Task<bool>

1 if the timeout was set. 0 if key does not exist or the timeout could not be set.

Remarks

If key is updated before the timeout has expired, then the timeout is removed as if the PERSIST command was invoked on key. For Redis versions < 2.1.3, existing timeouts cannot be overwritten. So, if key already has an associated timeout, it will do nothing and return 0. Since Redis 2.1.3, you can update the timeout of a key. It is also possible to remove the timeout using the PERSIST command. See the page on key expiry for more information.

KeyMigrateAsync(RedisKey, EndPoint, int, int, MigrateOptions, CommandFlags)

Atomically transfer a key from a source Redis instance to a destination Redis instance. On success the key is deleted from the original instance by default, and is guaranteed to exist in the target instance.

Task KeyMigrateAsync(RedisKey key, EndPoint toServer, int toDatabase = 0, int timeoutMilliseconds = 0, MigrateOptions migrateOptions = MigrateOptions.None, CommandFlags flags = CommandFlags.None)

Parameters

key RedisKey
toServer EndPoint
toDatabase int
timeoutMilliseconds int
migrateOptions MigrateOptions
flags CommandFlags

Returns

Task

Remarks

KeyMoveAsync(RedisKey, int, CommandFlags)

Move key from the currently selected database (see SELECT) to the specified destination database. When key already exists in the destination database, or it does not exist in the source database, it does nothing. It is possible to use MOVE as a locking primitive because of this.

Task<bool> KeyMoveAsync(RedisKey key, int database, CommandFlags flags = CommandFlags.None)

Parameters

key RedisKey
database int
flags CommandFlags

Returns

Task<bool>

1 if key was moved; 0 if key was not moved.

Remarks

KeyPersistAsync(RedisKey, CommandFlags)

Remove the existing timeout on key, turning the key from volatile (a key with an expire set) to persistent (a key that will never expire as no timeout is associated).

Task<bool> KeyPersistAsync(RedisKey key, CommandFlags flags = CommandFlags.None)

Parameters

key RedisKey
flags CommandFlags

Returns

Task<bool>

1 if the timeout was removed. 0 if key does not exist or does not have an associated timeout.

Remarks

KeyRandomAsync(CommandFlags)

Return a random key from the currently selected database.

Task<RedisKey> KeyRandomAsync(CommandFlags flags = CommandFlags.None)

Parameters

flags CommandFlags

Returns

Task<RedisKey>

the random key, or nil when the database is empty.

Remarks

KeyRenameAsync(RedisKey, RedisKey, When, CommandFlags)

Renames key to newkey. It returns an error when the source and destination names are the same, or when key does not exist.

Task<bool> KeyRenameAsync(RedisKey key, RedisKey newKey, When when = When.Always, CommandFlags flags = CommandFlags.None)

Parameters

key RedisKey
newKey RedisKey
when When
flags CommandFlags

Returns

Task<bool>

http://redis.io/commands/rename

Remarks

KeyRestoreAsync(RedisKey, byte[], TimeSpan?, CommandFlags)

Create a key associated with a value that is obtained by deserializing the provided serialized value (obtained via DUMP). If ttl is 0 the key is created without any expire, otherwise the specified expire time(in milliseconds) is set.

Task KeyRestoreAsync(RedisKey key, byte[] value, TimeSpan? expiry = null, CommandFlags flags = CommandFlags.None)

Parameters

key RedisKey
value byte[]
expiry TimeSpan?
flags CommandFlags

Returns

Task

Remarks

KeyTimeToLiveAsync(RedisKey, CommandFlags)

Returns the remaining time to live of a key that has a timeout. This introspection capability allows a Redis client to check how many seconds a given key will continue to be part of the dataset.

Task<TimeSpan?> KeyTimeToLiveAsync(RedisKey key, CommandFlags flags = CommandFlags.None)

Parameters

key RedisKey
flags CommandFlags

Returns

Task<TimeSpan?>

TTL, or nil when key does not exist or does not have a timeout.

Remarks

KeyTypeAsync(RedisKey, CommandFlags)

Returns the string representation of the type of the value stored at key. The different types that can be returned are: string, list, set, zset and hash.

Task<RedisType> KeyTypeAsync(RedisKey key, CommandFlags flags = CommandFlags.None)

Parameters

key RedisKey
flags CommandFlags

Returns

Task<RedisType>

type of key, or none when key does not exist.

Remarks

ListGetByIndexAsync(RedisKey, long, CommandFlags)

Returns the element at index index in the list stored at key. The index is zero-based, so 0 means the first element, 1 the second element and so on. Negative indices can be used to designate elements starting at the tail of the list. Here, -1 means the last element, -2 means the penultimate and so forth.

Task<RedisValue> ListGetByIndexAsync(RedisKey key, long index, CommandFlags flags = CommandFlags.None)

Parameters

key RedisKey
index long
flags CommandFlags

Returns

Task<RedisValue>

the requested element, or nil when index is out of range.

Remarks

ListInsertAfterAsync(RedisKey, RedisValue, RedisValue, CommandFlags)

Inserts value in the list stored at key either before or after the reference value pivot. When key does not exist, it is considered an empty list and no operation is performed.

Task<long> ListInsertAfterAsync(RedisKey key, RedisValue pivot, RedisValue value, CommandFlags flags = CommandFlags.None)

Parameters

key RedisKey
pivot RedisValue
value RedisValue
flags CommandFlags

Returns

Task<long>

the length of the list after the insert operation, or -1 when the value pivot was not found.

Remarks

ListInsertBeforeAsync(RedisKey, RedisValue, RedisValue, CommandFlags)

Inserts value in the list stored at key either before or after the reference value pivot. When key does not exist, it is considered an empty list and no operation is performed.

Task<long> ListInsertBeforeAsync(RedisKey key, RedisValue pivot, RedisValue value, CommandFlags flags = CommandFlags.None)

Parameters

key RedisKey
pivot RedisValue
value RedisValue
flags CommandFlags

Returns

Task<long>

the length of the list after the insert operation, or -1 when the value pivot was not found.

Remarks

ListLeftPopAsync(RedisKey, CommandFlags)

Removes and returns the first element of the list stored at key.

Task<RedisValue> ListLeftPopAsync(RedisKey key, CommandFlags flags = CommandFlags.None)

Parameters

key RedisKey
flags CommandFlags

Returns

Task<RedisValue>

the value of the first element, or nil when key does not exist.

Remarks

ListLeftPushAsync(RedisKey, RedisValue, When, CommandFlags)

Insert the specified value 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.

Task<long> ListLeftPushAsync(RedisKey key, RedisValue value, When when = When.Always, CommandFlags flags = CommandFlags.None)

Parameters

key RedisKey
value RedisValue
when When
flags CommandFlags

Returns

Task<long>

the length of the list after the push operations.

Remarks

ListLeftPushAsync(RedisKey, RedisValue[], CommandFlags)

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. Elements are inserted one after the other to the head of the list, from the leftmost element to the rightmost element. So for instance the command LPUSH mylist a b c will result into a list containing c as first element, b as second element and a as third element.

Task<long> ListLeftPushAsync(RedisKey key, RedisValue[] values, CommandFlags flags = CommandFlags.None)

Parameters

key RedisKey
values RedisValue[]
flags CommandFlags

Returns

Task<long>

the length of the list after the push operations.

Remarks

ListLengthAsync(RedisKey, CommandFlags)

Returns the length of the list stored at key. If key does not exist, it is interpreted as an empty list and 0 is returned.

Task<long> ListLengthAsync(RedisKey key, CommandFlags flags = CommandFlags.None)

Parameters

key RedisKey
flags CommandFlags

Returns

Task<long>

the length of the list at key.

Remarks

ListRangeAsync(RedisKey, long, long, CommandFlags)

Returns the specified elements of the list stored at key. The offsets start and stop are zero-based indexes, with 0 being the first element of the list (the head of the list), 1 being the next element and so on. These offsets can also be negative numbers indicating offsets starting at the end of the list.For example, -1 is the last element of the list, -2 the penultimate, and so on. Note that if you have a list of numbers from 0 to 100, LRANGE list 0 10 will return 11 elements, that is, the rightmost item is included.

Task<RedisValue[]> ListRangeAsync(RedisKey key, long start = 0, long stop = -1, CommandFlags flags = CommandFlags.None)

Parameters

key RedisKey
start long
stop long
flags CommandFlags

Returns

Task<RedisValue[]>

list of elements in the specified range.

Remarks

ListRemoveAsync(RedisKey, RedisValue, long, CommandFlags)

Removes the first count occurrences of elements equal to value from the list stored at key. The count argument influences the operation in the following ways: count > 0: Remove elements equal to value moving from head to tail. count < 0: Remove elements equal to value moving from tail to head. count = 0: Remove all elements equal to value.

Task<long> ListRemoveAsync(RedisKey key, RedisValue value, long count = 0, CommandFlags flags = CommandFlags.None)

Parameters

key RedisKey
value RedisValue
count long
flags CommandFlags

Returns

Task<long>

the number of removed elements.

Remarks

ListRightPopAsync(RedisKey, CommandFlags)

Removes and returns the last element of the list stored at key.

Task<RedisValue> ListRightPopAsync(RedisKey key, CommandFlags flags = CommandFlags.None)

Parameters

key RedisKey
flags CommandFlags

Returns

Task<RedisValue>

Remarks

ListRightPopLeftPushAsync(RedisKey, RedisKey, CommandFlags)

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.

Task<RedisValue> ListRightPopLeftPushAsync(RedisKey source, RedisKey destination, CommandFlags flags = CommandFlags.None)

Parameters

source RedisKey
destination RedisKey
flags CommandFlags

Returns

Task<RedisValue>

the element being popped and pushed.

Remarks

ListRightPushAsync(RedisKey, RedisValue, When, CommandFlags)

Insert the specified value 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.

Task<long> ListRightPushAsync(RedisKey key, RedisValue value, When when = When.Always, CommandFlags flags = CommandFlags.None)

Parameters

key RedisKey
value RedisValue
when When
flags CommandFlags

Returns

Task<long>

the length of the list after the push operation.

Remarks

ListRightPushAsync(RedisKey, RedisValue[], CommandFlags)

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. Elements are inserted one after the other to the tail of the list, from the leftmost element to the rightmost element. So for instance the command RPUSH mylist a b c will result into a list containing a as first element, b as second element and c as third element.

Task<long> ListRightPushAsync(RedisKey key, RedisValue[] values, CommandFlags flags = CommandFlags.None)

Parameters

key RedisKey
values RedisValue[]
flags CommandFlags

Returns

Task<long>

the length of the list after the push operation.

Remarks

ListSetByIndexAsync(RedisKey, long, RedisValue, CommandFlags)

Sets the list element at index to value. For more information on the index argument, see ListGetByIndex. An error is returned for out of range indexes.

Task ListSetByIndexAsync(RedisKey key, long index, RedisValue value, CommandFlags flags = CommandFlags.None)

Parameters

key RedisKey
index long
value RedisValue
flags CommandFlags

Returns

Task

Remarks

ListTrimAsync(RedisKey, long, long, CommandFlags)

Trim an existing list so that it will contain only the specified range of elements specified. Both start and stop are zero-based indexes, where 0 is the first element of the list (the head), 1 the next element and so on. For example: LTRIM foobar 0 2 will modify the list stored at foobar so that only the first three elements of the list will remain. start and end can also be negative numbers indicating offsets from the end of the list, where -1 is the last element of the list, -2 the penultimate element and so on.

Task ListTrimAsync(RedisKey key, long start, long stop, CommandFlags flags = CommandFlags.None)

Parameters

key RedisKey
start long
stop long
flags CommandFlags

Returns

Task

Remarks

LockExtendAsync(RedisKey, RedisValue, TimeSpan, CommandFlags)

Extends a lock, if the token value is correct

Task<bool> LockExtendAsync(RedisKey key, RedisValue value, TimeSpan expiry, CommandFlags flags = CommandFlags.None)

Parameters

key RedisKey
value RedisValue
expiry TimeSpan
flags CommandFlags

Returns

Task<bool>

LockQueryAsync(RedisKey, CommandFlags)

Queries the token held against a lock

Task<RedisValue> LockQueryAsync(RedisKey key, CommandFlags flags = CommandFlags.None)

Parameters

key RedisKey
flags CommandFlags

Returns

Task<RedisValue>

LockReleaseAsync(RedisKey, RedisValue, CommandFlags)

Releases a lock, if the token value is correct

Task<bool> LockReleaseAsync(RedisKey key, RedisValue value, CommandFlags flags = CommandFlags.None)

Parameters

key RedisKey
value RedisValue
flags CommandFlags

Returns

Task<bool>

LockTakeAsync(RedisKey, RedisValue, TimeSpan, CommandFlags)

Takes a lock (specifying a token value) if it is not already taken

Task<bool> LockTakeAsync(RedisKey key, RedisValue value, TimeSpan expiry, CommandFlags flags = CommandFlags.None)

Parameters

key RedisKey
value RedisValue
expiry TimeSpan
flags CommandFlags

Returns

Task<bool>

PublishAsync(RedisChannel, RedisValue, CommandFlags)

Posts a message to the given channel.

Task<long> PublishAsync(RedisChannel channel, RedisValue message, CommandFlags flags = CommandFlags.None)

Parameters

channel RedisChannel
message RedisValue
flags CommandFlags

Returns

Task<long>

the number of clients that received the message.

Remarks

ScriptEvaluateAsync(LoadedLuaScript, object, CommandFlags)

Execute a lua script against the server, using previously prepared and loaded script. This method sends only the SHA1 hash of the lua script to Redis. Named parameters, if any, are provided by the parameters object.

Task<RedisResult> ScriptEvaluateAsync(LoadedLuaScript script, object parameters = null, CommandFlags flags = CommandFlags.None)

Parameters

script LoadedLuaScript
parameters object
flags CommandFlags

Returns

Task<RedisResult>

ScriptEvaluateAsync(LuaScript, object, CommandFlags)

Execute a lua script against the server, using previously prepared script. Named parameters, if any, are provided by the parameters object.

Task<RedisResult> ScriptEvaluateAsync(LuaScript script, object parameters = null, CommandFlags flags = CommandFlags.None)

Parameters

script LuaScript
parameters object
flags CommandFlags

Returns

Task<RedisResult>

ScriptEvaluateAsync(byte[], RedisKey[], RedisValue[], CommandFlags)

Execute a Lua script against the server using just the SHA1 hash

Task<RedisResult> ScriptEvaluateAsync(byte[] hash, RedisKey[] keys = null, RedisValue[] values = null, CommandFlags flags = CommandFlags.None)

Parameters

hash byte[]
keys RedisKey[]
values RedisValue[]
flags CommandFlags

Returns

Task<RedisResult>

A dynamic representation of the script's result

Remarks

ScriptEvaluateAsync(string, RedisKey[], RedisValue[], CommandFlags)

Execute a Lua script against the server

Task<RedisResult> ScriptEvaluateAsync(string script, RedisKey[] keys = null, RedisValue[] values = null, CommandFlags flags = CommandFlags.None)

Parameters

script string
keys RedisKey[]
values RedisValue[]
flags CommandFlags

Returns

Task<RedisResult>

A dynamic representation of the script's result

Remarks

SetAddAsync(RedisKey, RedisValue, CommandFlags)

Add the specified member to the set stored at key. Specified members that are already a member of this set are ignored. If key does not exist, a new set is created before adding the specified members.

Task<bool> SetAddAsync(RedisKey key, RedisValue value, CommandFlags flags = CommandFlags.None)

Parameters

key RedisKey
value RedisValue
flags CommandFlags

Returns

Task<bool>

True if the specified member was not already present in the set, else False

Remarks

SetAddAsync(RedisKey, RedisValue[], CommandFlags)

Add the specified members to the set stored at key. Specified members that are already a member of this set are ignored. If key does not exist, a new set is created before adding the specified members.

Task<long> SetAddAsync(RedisKey key, RedisValue[] values, CommandFlags flags = CommandFlags.None)

Parameters

key RedisKey
values RedisValue[]
flags CommandFlags

Returns

Task<long>

the number of elements that were added to the set, not including all the elements already present into the set.

Remarks

SetCombineAndStoreAsync(SetOperation, RedisKey, RedisKey, RedisKey, CommandFlags)

This command is equal to SetCombine, but instead of returning the resulting set, it is stored in destination. If destination already exists, it is overwritten.

Task<long> SetCombineAndStoreAsync(SetOperation operation, RedisKey destination, RedisKey first, RedisKey second, CommandFlags flags = CommandFlags.None)

Parameters

operation SetOperation
destination RedisKey
first RedisKey
second RedisKey
flags CommandFlags

Returns

Task<long>

the number of elements in the resulting set.

Remarks

SetCombineAndStoreAsync(SetOperation, RedisKey, RedisKey[], CommandFlags)

This command is equal to SetCombine, but instead of returning the resulting set, it is stored in destination. If destination already exists, it is overwritten.

Task<long> SetCombineAndStoreAsync(SetOperation operation, RedisKey destination, RedisKey[] keys, CommandFlags flags = CommandFlags.None)

Parameters

operation SetOperation
destination RedisKey
keys RedisKey[]
flags CommandFlags

Returns

Task<long>

the number of elements in the resulting set.

Remarks

SetCombineAsync(SetOperation, RedisKey, RedisKey, CommandFlags)

Returns the members of the set resulting from the specified operation against the given sets.

Task<RedisValue[]> SetCombineAsync(SetOperation operation, RedisKey first, RedisKey second, CommandFlags flags = CommandFlags.None)

Parameters

operation SetOperation
first RedisKey
second RedisKey
flags CommandFlags

Returns

Task<RedisValue[]>

list with members of the resulting set.

Remarks

SetCombineAsync(SetOperation, RedisKey[], CommandFlags)

Returns the members of the set resulting from the specified operation against the given sets.

Task<RedisValue[]> SetCombineAsync(SetOperation operation, RedisKey[] keys, CommandFlags flags = CommandFlags.None)

Parameters

operation SetOperation
keys RedisKey[]
flags CommandFlags

Returns

Task<RedisValue[]>

list with members of the resulting set.

Remarks

SetContainsAsync(RedisKey, RedisValue, CommandFlags)

Returns if member is a member of the set stored at key.

Task<bool> SetContainsAsync(RedisKey key, RedisValue value, CommandFlags flags = CommandFlags.None)

Parameters

key RedisKey
value RedisValue
flags CommandFlags

Returns

Task<bool>

1 if the element is a member of the set. 0 if the element is not a member of the set, or if key does not exist.

Remarks

SetLengthAsync(RedisKey, CommandFlags)

Returns the set cardinality (number of elements) of the set stored at key.

Task<long> SetLengthAsync(RedisKey key, CommandFlags flags = CommandFlags.None)

Parameters

key RedisKey
flags CommandFlags

Returns

Task<long>

the cardinality (number of elements) of the set, or 0 if key does not exist.

Remarks

SetMembersAsync(RedisKey, CommandFlags)

Returns all the members of the set value stored at key.

Task<RedisValue[]> SetMembersAsync(RedisKey key, CommandFlags flags = CommandFlags.None)

Parameters

key RedisKey
flags CommandFlags

Returns

Task<RedisValue[]>

all elements of the set.

Remarks

SetMoveAsync(RedisKey, RedisKey, RedisValue, CommandFlags)

Move member from the set at source to the set at destination. This operation is atomic. In every given moment the element will appear to be a member of source or destination for other clients. When the specified element already exists in the destination set, it is only removed from the source set.

Task<bool> SetMoveAsync(RedisKey source, RedisKey destination, RedisValue value, CommandFlags flags = CommandFlags.None)

Parameters

source RedisKey
destination RedisKey
value RedisValue
flags CommandFlags

Returns

Task<bool>

1 if the element is moved. 0 if the element is not a member of source and no operation was performed.

Remarks

SetPopAsync(RedisKey, CommandFlags)

Removes and returns a random element from the set value stored at key.

Task<RedisValue> SetPopAsync(RedisKey key, CommandFlags flags = CommandFlags.None)

Parameters

key RedisKey
flags CommandFlags

Returns

Task<RedisValue>

the removed element, or nil when key does not exist.

Remarks

SetRandomMemberAsync(RedisKey, CommandFlags)

Return a random element from the set value stored at key.

Task<RedisValue> SetRandomMemberAsync(RedisKey key, CommandFlags flags = CommandFlags.None)

Parameters

key RedisKey
flags CommandFlags

Returns

Task<RedisValue>

the randomly selected element, or nil when key does not exist

Remarks

SetRandomMembersAsync(RedisKey, long, CommandFlags)

Return an array of count distinct elements if count is positive. If called with a negative count the behavior changes and the command is allowed to return the same element multiple times. In this case the numer of returned elements is the absolute value of the specified count.

Task<RedisValue[]> SetRandomMembersAsync(RedisKey key, long count, CommandFlags flags = CommandFlags.None)

Parameters

key RedisKey
count long
flags CommandFlags

Returns

Task<RedisValue[]>

an array of elements, or an empty array when key does not exist

Remarks

SetRemoveAsync(RedisKey, RedisValue, CommandFlags)

Remove the specified member from the set stored at key. Specified members that are not a member of this set are ignored.

Task<bool> SetRemoveAsync(RedisKey key, RedisValue value, CommandFlags flags = CommandFlags.None)

Parameters

key RedisKey
value RedisValue
flags CommandFlags

Returns

Task<bool>

True if the specified member was already present in the set, else False

Remarks

SetRemoveAsync(RedisKey, RedisValue[], CommandFlags)

Remove the specified members from the set stored at key. Specified members that are not a member of this set are ignored.

Task<long> SetRemoveAsync(RedisKey key, RedisValue[] values, CommandFlags flags = CommandFlags.None)

Parameters

key RedisKey
values RedisValue[]
flags CommandFlags

Returns

Task<long>

the number of members that were removed from the set, not including non existing members.

Remarks

SortAndStoreAsync(RedisKey, RedisKey, long, long, Order, SortType, RedisValue, RedisValue[], CommandFlags)

Sorts a list, set or sorted set (numerically or alphabetically, ascending by default); By default, the elements themselves are compared, but the values can also be used to perform external key-lookups using the by parameter. By default, the elements themselves are returned, but external key-lookups (one or many) can be performed instead by specifying the get parameter (note that # specifies the element itself, when used in get). Referring to the redis SORT documentation for examples is recommended. When used in hashes, by and get can be used to specify fields using -> notation (again, refer to redis documentation).

Task<long> SortAndStoreAsync(RedisKey destination, RedisKey key, long skip = 0, long take = -1, Order order = Order.Ascending, SortType sortType = SortType.Numeric, RedisValue by = default, RedisValue[] get = null, CommandFlags flags = CommandFlags.None)

Parameters

destination RedisKey
key RedisKey
skip long
take long
order Order
sortType SortType
by RedisValue
get RedisValue[]
flags CommandFlags

Returns

Task<long>

Returns the number of elements stored in the new list

Remarks

SortAsync(RedisKey, long, long, Order, SortType, RedisValue, RedisValue[], CommandFlags)

Sorts a list, set or sorted set (numerically or alphabetically, ascending by default); By default, the elements themselves are compared, but the values can also be used to perform external key-lookups using the by parameter. By default, the elements themselves are returned, but external key-lookups (one or many) can be performed instead by specifying the get parameter (note that # specifies the element itself, when used in get). Referring to the redis SORT documentation for examples is recommended. When used in hashes, by and get can be used to specify fields using -> notation (again, refer to redis documentation).

Task<RedisValue[]> SortAsync(RedisKey key, long skip = 0, long take = -1, Order order = Order.Ascending, SortType sortType = SortType.Numeric, RedisValue by = default, RedisValue[] get = null, CommandFlags flags = CommandFlags.None)

Parameters

key RedisKey
skip long
take long
order Order
sortType SortType
by RedisValue
get RedisValue[]
flags CommandFlags

Returns

Task<RedisValue[]>

Returns the sorted elements, or the external values if get is specified

Remarks

SortedSetAddAsync(RedisKey, RedisValue, double, CommandFlags)

Adds the specified member with the specified score to the sorted set stored at key. If the specified member is already a member of the sorted set, the score is updated and the element reinserted at the right position to ensure the correct ordering.

Task<bool> SortedSetAddAsync(RedisKey key, RedisValue member, double score, CommandFlags flags)

Parameters

key RedisKey
member RedisValue
score double
flags CommandFlags

Returns

Task<bool>

True if the value was added, False if it already existed (the score is still updated)

Remarks

SortedSetAddAsync(RedisKey, RedisValue, double, When, CommandFlags)

Adds the specified member with the specified score to the sorted set stored at key. If the specified member is already a member of the sorted set, the score is updated and the element reinserted at the right position to ensure the correct ordering.

Task<bool> SortedSetAddAsync(RedisKey key, RedisValue member, double score, When when = When.Always, CommandFlags flags = CommandFlags.None)

Parameters

key RedisKey
member RedisValue
score double
when When
flags CommandFlags

Returns

Task<bool>

True if the value was added, False if it already existed (the score is still updated)

Remarks

SortedSetAddAsync(RedisKey, SortedSetEntry[], CommandFlags)

Adds all the specified members with the specified scores to the sorted set stored at key. If a specified member is already a member of the sorted set, the score is updated and the element reinserted at the right position to ensure the correct ordering.

Task<long> SortedSetAddAsync(RedisKey key, SortedSetEntry[] values, CommandFlags flags)

Parameters

key RedisKey
values SortedSetEntry[]
flags CommandFlags

Returns

Task<long>

The number of elements added to the sorted sets, not including elements already existing for which the score was updated.

Remarks

SortedSetAddAsync(RedisKey, SortedSetEntry[], When, CommandFlags)

Adds all the specified members with the specified scores to the sorted set stored at key. If a specified member is already a member of the sorted set, the score is updated and the element reinserted at the right position to ensure the correct ordering.

Task<long> SortedSetAddAsync(RedisKey key, SortedSetEntry[] values, When when = When.Always, CommandFlags flags = CommandFlags.None)

Parameters

key RedisKey
values SortedSetEntry[]
when When
flags CommandFlags

Returns

Task<long>

The number of elements added to the sorted sets, not including elements already existing for which the score was updated.

Remarks

SortedSetCombineAndStoreAsync(SetOperation, RedisKey, RedisKey, RedisKey, Aggregate, CommandFlags)

Computes a set operation over two sorted sets, and stores the result in destination, optionally performing a specific aggregation (defaults to sum)

Task<long> SortedSetCombineAndStoreAsync(SetOperation operation, RedisKey destination, RedisKey first, RedisKey second, Aggregate aggregate = Aggregate.Sum, CommandFlags flags = CommandFlags.None)

Parameters

operation SetOperation
destination RedisKey
first RedisKey
second RedisKey
aggregate Aggregate
flags CommandFlags

Returns

Task<long>

the number of elements in the resulting sorted set at destination

Remarks

SortedSetCombineAndStoreAsync(SetOperation, RedisKey, RedisKey[], double[], Aggregate, CommandFlags)

Computes a set operation over multiple sorted sets (optionally using per-set weights), and stores the result in destination, optionally performing a specific aggregation (defaults to sum)

Task<long> SortedSetCombineAndStoreAsync(SetOperation operation, RedisKey destination, RedisKey[] keys, double[] weights = null, Aggregate aggregate = Aggregate.Sum, CommandFlags flags = CommandFlags.None)

Parameters

operation SetOperation
destination RedisKey
keys RedisKey[]
weights double[]
aggregate Aggregate
flags CommandFlags

Returns

Task<long>

the number of elements in the resulting sorted set at destination

Remarks

SortedSetDecrementAsync(RedisKey, RedisValue, double, CommandFlags)

Decrements the score of member in the sorted set stored at key by decrement. If member does not exist in the sorted set, it is added with -decrement as its score (as if its previous score was 0.0).

Task<double> SortedSetDecrementAsync(RedisKey key, RedisValue member, double value, CommandFlags flags = CommandFlags.None)

Parameters

key RedisKey
member RedisValue
value double
flags CommandFlags

Returns

Task<double>

the new score of member

Remarks

SortedSetIncrementAsync(RedisKey, RedisValue, double, CommandFlags)

Increments the score of member in the sorted set stored at key by increment. If member does not exist in the sorted set, it is added with increment as its score (as if its previous score was 0.0).

Task<double> SortedSetIncrementAsync(RedisKey key, RedisValue member, double value, CommandFlags flags = CommandFlags.None)

Parameters

key RedisKey
member RedisValue
value double
flags CommandFlags

Returns

Task<double>

the new score of member

Remarks

SortedSetLengthAsync(RedisKey, double, double, Exclude, CommandFlags)

Returns the sorted set cardinality (number of elements) of the sorted set stored at key.

Task<long> SortedSetLengthAsync(RedisKey key, double min = -Infinity, double max = Infinity, Exclude exclude = Exclude.None, CommandFlags flags = CommandFlags.None)

Parameters

key RedisKey
min double
max double
exclude Exclude
flags CommandFlags

Returns

Task<long>

the cardinality (number of elements) of the sorted set, or 0 if key does not exist.

Remarks

SortedSetLengthByValueAsync(RedisKey, RedisValue, RedisValue, Exclude, CommandFlags)

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.

Task<long> SortedSetLengthByValueAsync(RedisKey key, RedisValue min, RedisValue max, Exclude exclude = Exclude.None, CommandFlags flags = CommandFlags.None)

Parameters

key RedisKey
min RedisValue
max RedisValue
exclude Exclude
flags CommandFlags

Returns

Task<long>

the number of elements in the specified score range.

Remarks

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.

SortedSetRangeByRankAsync(RedisKey, long, long, Order, CommandFlags)

Returns the specified range of elements in the sorted set stored at key. By default the elements are considered to be ordered from the lowest to the highest score. Lexicographical order is used for elements with equal score. Both start and stop are zero-based indexes, where 0 is the first element, 1 is the next element and so on. They can also be negative numbers indicating offsets from the end of the sorted set, with -1 being the last element of the sorted set, -2 the penultimate element and so on.

Task<RedisValue[]> SortedSetRangeByRankAsync(RedisKey key, long start = 0, long stop = -1, Order order = Order.Ascending, CommandFlags flags = CommandFlags.None)

Parameters

key RedisKey
start long
stop long
order Order
flags CommandFlags

Returns

Task<RedisValue[]>

list of elements in the specified range

Remarks

SortedSetRangeByRankWithScoresAsync(RedisKey, long, long, Order, CommandFlags)

Returns the specified range of elements in the sorted set stored at key. By default the elements are considered to be ordered from the lowest to the highest score. Lexicographical order is used for elements with equal score. Both start and stop are zero-based indexes, where 0 is the first element, 1 is the next element and so on. They can also be negative numbers indicating offsets from the end of the sorted set, with -1 being the last element of the sorted set, -2 the penultimate element and so on.

Task<SortedSetEntry[]> SortedSetRangeByRankWithScoresAsync(RedisKey key, long start = 0, long stop = -1, Order order = Order.Ascending, CommandFlags flags = CommandFlags.None)

Parameters

key RedisKey
start long
stop long
order Order
flags CommandFlags

Returns

Task<SortedSetEntry[]>

list of elements in the specified range

Remarks

SortedSetRangeByScoreAsync(RedisKey, double, double, Exclude, Order, long, long, CommandFlags)

Returns the specified range of elements in the sorted set stored at key. By default the elements are considered to be ordered from the lowest to the highest score. Lexicographical order is used for elements with equal score. Start and stop are used to specify the min and max range for score values. Similar to other range methods the values are inclusive.

Task<RedisValue[]> SortedSetRangeByScoreAsync(RedisKey key, double start = -Infinity, double stop = Infinity, Exclude exclude = Exclude.None, Order order = Order.Ascending, long skip = 0, long take = -1, CommandFlags flags = CommandFlags.None)

Parameters

key RedisKey
start double
stop double
exclude Exclude
order Order
skip long
take long
flags CommandFlags

Returns

Task<RedisValue[]>

list of elements in the specified score range

Remarks

SortedSetRangeByScoreWithScoresAsync(RedisKey, double, double, Exclude, Order, long, long, CommandFlags)

Returns the specified range of elements in the sorted set stored at key. By default the elements are considered to be ordered from the lowest to the highest score. Lexicographical order is used for elements with equal score. Start and stop are used to specify the min and max range for score values. Similar to other range methods the values are inclusive.

Task<SortedSetEntry[]> SortedSetRangeByScoreWithScoresAsync(RedisKey key, double start = -Infinity, double stop = Infinity, Exclude exclude = Exclude.None, Order order = Order.Ascending, long skip = 0, long take = -1, CommandFlags flags = CommandFlags.None)

Parameters

key RedisKey
start double
stop double
exclude Exclude
order Order
skip long
take long
flags CommandFlags

Returns

Task<SortedSetEntry[]>

list of elements in the specified score range

Remarks

SortedSetRangeByValueAsync(RedisKey, RedisValue, RedisValue, Exclude, long, long, CommandFlags)

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.

Task<RedisValue[]> SortedSetRangeByValueAsync(RedisKey key, RedisValue min = default, RedisValue max = default, Exclude exclude = Exclude.None, long skip = 0, long take = -1, CommandFlags flags = CommandFlags.None)

Parameters

key RedisKey
min RedisValue
max RedisValue
exclude Exclude
skip long
take long
flags CommandFlags

Returns

Task<RedisValue[]>

list of elements in the specified score range.

Remarks

SortedSetRankAsync(RedisKey, RedisValue, Order, CommandFlags)

Returns the rank of member in the sorted set stored at key, by default with the scores ordered from low to high. The rank (or index) is 0-based, which means that the member with the lowest score has rank 0.

Task<long?> SortedSetRankAsync(RedisKey key, RedisValue member, Order order = Order.Ascending, CommandFlags flags = CommandFlags.None)

Parameters

key RedisKey
member RedisValue
order Order
flags CommandFlags

Returns

Task<long?>

If member exists in the sorted set, the rank of member; If member does not exist in the sorted set or key does not exist, null

Remarks

SortedSetRemoveAsync(RedisKey, RedisValue, CommandFlags)

Removes the specified member from the sorted set stored at key. Non existing members are ignored.

Task<bool> SortedSetRemoveAsync(RedisKey key, RedisValue member, CommandFlags flags = CommandFlags.None)

Parameters

key RedisKey
member RedisValue
flags CommandFlags

Returns

Task<bool>

True if the member existed in the sorted set and was removed; False otherwise.

Remarks

SortedSetRemoveAsync(RedisKey, RedisValue[], CommandFlags)

Removes the specified members from the sorted set stored at key. Non existing members are ignored.

Task<long> SortedSetRemoveAsync(RedisKey key, RedisValue[] members, CommandFlags flags = CommandFlags.None)

Parameters

key RedisKey
members RedisValue[]
flags CommandFlags

Returns

Task<long>

The number of members removed from the sorted set, not including non existing members.

Remarks

SortedSetRemoveRangeByRankAsync(RedisKey, long, long, CommandFlags)

Removes all elements in the sorted set stored at key with rank between start and stop. Both start and stop are 0 -based indexes with 0 being the element with the lowest score. These indexes can be negative numbers, where they indicate offsets starting at the element with the highest score. For example: -1 is the element with the highest score, -2 the element with the second highest score and so forth.

Task<long> SortedSetRemoveRangeByRankAsync(RedisKey key, long start, long stop, CommandFlags flags = CommandFlags.None)

Parameters

key RedisKey
start long
stop long
flags CommandFlags

Returns

Task<long>

the number of elements removed.

Remarks

SortedSetRemoveRangeByScoreAsync(RedisKey, double, double, Exclude, CommandFlags)

Removes all elements in the sorted set stored at key with a score between min and max (inclusive by default).

Task<long> SortedSetRemoveRangeByScoreAsync(RedisKey key, double start, double stop, Exclude exclude = Exclude.None, CommandFlags flags = CommandFlags.None)

Parameters

key RedisKey
start double
stop double
exclude Exclude
flags CommandFlags

Returns

Task<long>

the number of elements removed.

Remarks

SortedSetRemoveRangeByValueAsync(RedisKey, RedisValue, RedisValue, Exclude, CommandFlags)

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.

Task<long> SortedSetRemoveRangeByValueAsync(RedisKey key, RedisValue min, RedisValue max, Exclude exclude = Exclude.None, CommandFlags flags = CommandFlags.None)

Parameters

key RedisKey
min RedisValue
max RedisValue
exclude Exclude
flags CommandFlags

Returns

Task<long>

the number of elements removed.

Remarks

SortedSetScoreAsync(RedisKey, RedisValue, CommandFlags)

Returns the score of member in the sorted set at key; If member does not exist in the sorted set, or key does not exist, nil is returned.

Task<double?> SortedSetScoreAsync(RedisKey key, RedisValue member, CommandFlags flags = CommandFlags.None)

Parameters

key RedisKey
member RedisValue
flags CommandFlags

Returns

Task<double?>

the score of member

Remarks

StringAppendAsync(RedisKey, RedisValue, CommandFlags)

If key already exists and is a string, this command appends the value at the end of the string. If key does not exist it is created and set as an empty string, so APPEND will be similar to SET in this special case.

Task<long> StringAppendAsync(RedisKey key, RedisValue value, CommandFlags flags = CommandFlags.None)

Parameters

key RedisKey
value RedisValue
flags CommandFlags

Returns

Task<long>

the length of the string after the append operation.

Remarks

StringBitCountAsync(RedisKey, long, long, CommandFlags)

Count the number of set bits (population counting) in a string. By default all the bytes contained in the string are examined.It is possible to specify the counting operation only in an interval passing the additional arguments start and end. Like for the GETRANGE command start and end can contain negative values in order to index bytes starting from the end of the string, where -1 is the last byte, -2 is the penultimate, and so forth.

Task<long> StringBitCountAsync(RedisKey key, long start = 0, long end = -1, CommandFlags flags = CommandFlags.None)

Parameters

key RedisKey
start long
end long
flags CommandFlags

Returns

Task<long>

The number of bits set to 1

Remarks

StringBitOperationAsync(Bitwise, RedisKey, RedisKey, RedisKey, CommandFlags)

Perform a bitwise operation between multiple keys (containing string values) and store the result in the destination key. The BITOP command supports four bitwise operations; note that NOT is a unary operator: the second key should be omitted in this case and only the first key will be considered. The result of the operation is always stored at destkey.

Task<long> StringBitOperationAsync(Bitwise operation, RedisKey destination, RedisKey first, RedisKey second = default, CommandFlags flags = CommandFlags.None)

Parameters

operation Bitwise
destination RedisKey
first RedisKey
second RedisKey
flags CommandFlags

Returns

Task<long>

The size of the string stored in the destination key, that is equal to the size of the longest input string.

Remarks

StringBitOperationAsync(Bitwise, RedisKey, RedisKey[], CommandFlags)

Perform a bitwise operation between multiple keys (containing string values) and store the result in the destination key. The BITOP command supports four bitwise operations; note that NOT is a unary operator. The result of the operation is always stored at destkey.

Task<long> StringBitOperationAsync(Bitwise operation, RedisKey destination, RedisKey[] keys, CommandFlags flags = CommandFlags.None)

Parameters

operation Bitwise
destination RedisKey
keys RedisKey[]
flags CommandFlags

Returns

Task<long>

The size of the string stored in the destination key, that is equal to the size of the longest input string.

Remarks

StringBitPositionAsync(RedisKey, bool, long, long, CommandFlags)

Return the position of the first bit set to 1 or 0 in a string. The position is returned thinking at the string as an array of bits from left to right where the first byte most significant bit is at position 0, the second byte most significant big is at position 8 and so forth. An start and end may be specified; these are in bytes, not bits; start and end can contain negative values in order to index bytes starting from the end of the string, where -1 is the last byte, -2 is the penultimate, and so forth.

Task<long> StringBitPositionAsync(RedisKey key, bool bit, long start = 0, long end = -1, CommandFlags flags = CommandFlags.None)

Parameters

key RedisKey
bit bool
start long
end long
flags CommandFlags

Returns

Task<long>

The command returns the position of the first bit set to 1 or 0 according to the request. If we look for set bits(the bit argument is 1) and the string is empty or composed of just zero bytes, -1 is returned.

Remarks

StringDecrementAsync(RedisKey, double, CommandFlags)

Decrements the string representing a floating point number stored at key by the specified increment. If the key does not exist, it is set to 0 before performing the operation. The precision of the output is fixed at 17 digits after the decimal point regardless of the actual internal precision of the computation.

Task<double> StringDecrementAsync(RedisKey key, double value, CommandFlags flags = CommandFlags.None)

Parameters

key RedisKey
value double
flags CommandFlags

Returns

Task<double>

the value of key after the increment

Remarks

StringDecrementAsync(RedisKey, long, CommandFlags)

Decrements the number stored at key by decrement. If the key does not exist, it is set to 0 before performing the operation. An error is returned if the key contains a value of the wrong type or contains a string that is not representable as integer. This operation is limited to 64 bit signed integers.

Task<long> StringDecrementAsync(RedisKey key, long value = 1, CommandFlags flags = CommandFlags.None)

Parameters

key RedisKey
value long
flags CommandFlags

Returns

Task<long>

the value of key after the increment

Remarks

StringGetAsync(RedisKey, CommandFlags)

Get the value of key. If the key does not exist the special value nil is returned. An error is returned if the value stored at key is not a string, because GET only handles string values.

Task<RedisValue> StringGetAsync(RedisKey key, CommandFlags flags = CommandFlags.None)

Parameters

key RedisKey
flags CommandFlags

Returns

Task<RedisValue>

the value of key, or nil when key does not exist.

Remarks

StringGetAsync(RedisKey[], CommandFlags)

Returns the values of all specified keys. For every key that does not hold a string value or does not exist, the special value nil is returned.

Task<RedisValue[]> StringGetAsync(RedisKey[] keys, CommandFlags flags = CommandFlags.None)

Parameters

keys RedisKey[]
flags CommandFlags

Returns

Task<RedisValue[]>

Remarks

StringGetBitAsync(RedisKey, long, CommandFlags)

Returns the bit value at offset in the string value stored at key. When offset is beyond the string length, the string is assumed to be a contiguous space with 0 bits.

Task<bool> StringGetBitAsync(RedisKey key, long offset, CommandFlags flags = CommandFlags.None)

Parameters

key RedisKey
offset long
flags CommandFlags

Returns

Task<bool>

the bit value stored at offset.

Remarks

StringGetRangeAsync(RedisKey, long, long, CommandFlags)

Returns the substring of the string value stored at key, determined by the offsets start and end (both are inclusive). Negative offsets can be used in order to provide an offset starting from the end of the string. So -1 means the last character, -2 the penultimate and so forth.

Task<RedisValue> StringGetRangeAsync(RedisKey key, long start, long end, CommandFlags flags = CommandFlags.None)

Parameters

key RedisKey
start long
end long
flags CommandFlags

Returns

Task<RedisValue>

the substring of the string value stored at key

Remarks

StringGetSetAsync(RedisKey, RedisValue, CommandFlags)

Atomically sets key to value and returns the old value stored at key.

Task<RedisValue> StringGetSetAsync(RedisKey key, RedisValue value, CommandFlags flags = CommandFlags.None)

Parameters

key RedisKey
value RedisValue
flags CommandFlags

Returns

Task<RedisValue>

the old value stored at key, or nil when key did not exist.

Remarks

StringGetWithExpiryAsync(RedisKey, CommandFlags)

Get the value of key. If the key does not exist the special value nil is returned. An error is returned if the value stored at key is not a string, because GET only handles string values.

Task<RedisValueWithExpiry> StringGetWithExpiryAsync(RedisKey key, CommandFlags flags = CommandFlags.None)

Parameters

key RedisKey
flags CommandFlags

Returns

Task<RedisValueWithExpiry>

the value of key, or nil when key does not exist.

Remarks

StringIncrementAsync(RedisKey, double, CommandFlags)

Increment the string representing a floating point number stored at key by the specified increment. If the key does not exist, it is set to 0 before performing the operation. The precision of the output is fixed at 17 digits after the decimal point regardless of the actual internal precision of the computation.

Task<double> StringIncrementAsync(RedisKey key, double value, CommandFlags flags = CommandFlags.None)

Parameters

key RedisKey
value double
flags CommandFlags

Returns

Task<double>

the value of key after the increment

Remarks

StringIncrementAsync(RedisKey, long, CommandFlags)

Increments the number stored at key by increment. If the key does not exist, it is set to 0 before performing the operation. An error is returned if the key contains a value of the wrong type or contains a string that is not representable as integer. This operation is limited to 64 bit signed integers.

Task<long> StringIncrementAsync(RedisKey key, long value = 1, CommandFlags flags = CommandFlags.None)

Parameters

key RedisKey
value long
flags CommandFlags

Returns

Task<long>

the value of key after the increment

Remarks

StringLengthAsync(RedisKey, CommandFlags)

Returns the length of the string value stored at key.

Task<long> StringLengthAsync(RedisKey key, CommandFlags flags = CommandFlags.None)

Parameters

key RedisKey
flags CommandFlags

Returns

Task<long>

the length of the string at key, or 0 when key does not exist.

Remarks

StringSetAsync(RedisKey, RedisValue, TimeSpan?, When, CommandFlags)

Set key to hold the string value. If key already holds a value, it is overwritten, regardless of its type.

Task<bool> StringSetAsync(RedisKey key, RedisValue value, TimeSpan? expiry = null, When when = When.Always, CommandFlags flags = CommandFlags.None)

Parameters

key RedisKey
value RedisValue
expiry TimeSpan?
when When
flags CommandFlags

Returns

Task<bool>

Remarks

StringSetAsync(KeyValuePair<RedisKey, RedisValue>[], When, CommandFlags)

Sets the given keys to their respective values. If "not exists" is specified, this will not perform any operation at all even if just a single key already exists.

Task<bool> StringSetAsync(KeyValuePair<RedisKey, RedisValue>[] values, When when = When.Always, CommandFlags flags = CommandFlags.None)

Parameters

values KeyValuePair<RedisKey, RedisValue>[]
when When
flags CommandFlags

Returns

Task<bool>

True if the keys were set, else False

Remarks

StringSetBitAsync(RedisKey, long, bool, CommandFlags)

Sets or clears the bit at offset in the string value stored at key. The bit is either set or cleared depending on value, which can be either 0 or 1. When key does not exist, a new string value is created.The string is grown to make sure it can hold a bit at offset.

Task<bool> StringSetBitAsync(RedisKey key, long offset, bool bit, CommandFlags flags = CommandFlags.None)

Parameters

key RedisKey
offset long
bit bool
flags CommandFlags

Returns

Task<bool>

the original bit value stored at offset.

Remarks

StringSetRangeAsync(RedisKey, long, RedisValue, CommandFlags)

Overwrites part of the string stored at key, starting at the specified offset, for the entire length of value. If the offset is larger than the current length of the string at key, the string is padded with zero-bytes to make offset fit. Non-existing keys are considered as empty strings, so this command will make sure it holds a string large enough to be able to set value at offset.

Task<RedisValue> StringSetRangeAsync(RedisKey key, long offset, RedisValue value, CommandFlags flags = CommandFlags.None)

Parameters

key RedisKey
offset long
value RedisValue
flags CommandFlags

Returns

Task<RedisValue>

the length of the string after it was modified by the command.

Remarks