C# Class BB.Caching.Cache.Shared.Strings

Commands that apply to key/value pairs, where the value can be a string, a BLOB, or interpreted as a number
http://redis.io/commands#string
Datei anzeigen Open project: JesseBuesking/BB.Caching

Public Methods

Method Description
Append ( RedisKey key, RedisValue value ) : long

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.

http://redis.io/commands/append

Append ( RedisKey key, byte value ) : long

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.

http://redis.io/commands/append

AppendAsync ( RedisKey key, RedisValue value ) : Task

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.

http://redis.io/commands/append

AppendAsync ( RedisKey key, byte value ) : Task

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.

http://redis.io/commands/append

CountSetBits ( RedisKey key, long start, long end = -1 ) : long

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.

http://redis.io/commands/bitcount

CountSetBitsAsync ( RedisKey key, long start, long end = -1 ) : Task

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.

http://redis.io/commands/bitcount

Decrement ( RedisKey key, long value = 1 ) : long

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.

http://redis.io/commands/decrbyhttp://redis.io/commands/decr

DecrementAsync ( RedisKey key, long value = 1 ) : Task

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.

http://redis.io/commands/decrbyhttp://redis.io/commands/decr

Get ( RedisKey key ) : RedisValue

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.

http://redis.io/commands/get

Get ( RedisKey key, System.TimeSpan expire ) : RedisValue

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.

http://redis.io/commands/get

Get ( RedisKey key, int start, int end ) : RedisValue

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. The function handles out of range requests by limiting the resulting range to the actual length of the string.http://redis.io/commands/getrange

Get ( RedisKey keys ) : RedisValue[]

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. Because of this, the operation never fails.

http://redis.io/commands/mget

GetAsync ( RedisKey key ) : Task

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.

http://redis.io/commands/get

GetAsync ( RedisKey key, System.TimeSpan expire ) : Task

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.

http://redis.io/commands/get

GetAsync ( RedisKey key, int start, int end ) : Task

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. The function handles out of range requests by limiting the resulting range to the actual length of the string.http://redis.io/commands/getrange

GetAsync ( RedisKey keys ) : Task

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. Because of this, the operation never fails.

http://redis.io/commands/mget

GetBit ( RedisKey key, long offset ) : bool

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. When key does not exist it is assumed to be an empty string, so offset is always out of range and the value is also assumed to be a contiguous space with 0 bits.http://redis.io/commands/getbit

GetBitAsync ( RedisKey key, long offset ) : Task

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. When key does not exist it is assumed to be an empty string, so offset is always out of range and the value is also assumed to be a contiguous space with 0 bits.http://redis.io/commands/getbit

GetLength ( RedisKey key ) : long

Returns the length of the string value stored at key. An error is returned when key holds a non-string value.

http://redis.io/commands/strlen

GetLengthAsync ( RedisKey key ) : Task

Returns the length of the string value stored at key. An error is returned when key holds a non-string value.

http://redis.io/commands/strlen

GetSet ( RedisKey key, RedisValue value ) : RedisValue

Atomically sets key to value and returns the old value stored at key. Returns an error when key exists but does not hold a string value.

http://redis.io/commands/getset

GetSet ( RedisKey key, RedisValue value, System.TimeSpan expire ) : RedisValue

Atomically sets key to value and returns the old value stored at key. Returns an error when key exists but does not hold a string value.

http://redis.io/commands/getset

GetSetAsync ( RedisKey key, RedisValue value ) : Task

Atomically sets key to value and returns the old value stored at key. Returns an error when key exists but does not hold a string value.

http://redis.io/commands/getset

GetSetAsync ( RedisKey key, RedisValue value, System.TimeSpan expire ) : Task

Atomically sets key to value and returns the old value stored at key. Returns an error when key exists but does not hold a string value.

http://redis.io/commands/getset

Increment ( RedisKey key, long value = 1 ) : long

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.

http://redis.io/commands/incrbyhttp://redis.io/commands/incr

IncrementAsync ( RedisKey key, long value = 1 ) : Task

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.

http://redis.io/commands/incrbyhttp://redis.io/commands/incr

ReleaseLock ( RedisKey key, RedisValue value ) : void

Releases a lock that was taken successfully via TakeLock. You should not release a lock that you did not take, as this will cause problems.

ReleaseLockAsync ( RedisKey key, RedisValue value ) : System.Threading.Tasks.Task

Releases a lock that was taken successfully via TakeLock. You should not release a lock that you did not take, as this will cause problems.

Set ( RedisKey key, long offset, RedisValue value ) : RedisValue

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.

Note that the maximum offset that you can set is 229 -1 (536870911), as Redis Strings are limited to 512 megabytes. If you need to grow beyond this size, you can use multiple keys.

Warning: When setting the last possible byte and the string value stored at key does not yet hold a string value, or holds a small string value, Redis needs to allocate all intermediate memory which can block the server for some time. On a 2010 MacBook Pro, setting byte number 536870911 (512MB allocation) takes ~300ms, setting byte number 134217728 (128MB allocation) takes ~80ms, setting bit number 33554432 (32MB allocation) takes ~30ms and setting bit number 8388608 (8MB allocation) takes ~8ms. Note that once this first allocation is done, subsequent calls to SETRANGE for the same key will not have the allocation overhead.

http://redis.io/commands/setrange
Set ( RedisValue>.Dictionary values ) : void

Sets the given keys to their respective values. MSET replaces existing values with new values, just as regular SET. See MSETNX if you don't want to overwrite existing values.

MSET is atomic, so all given keys are set at once. It is not possible for clients to see that some of the keys were updated while others are unchanged.http://redis.io/commands/mset

Set ( RedisKey key, RedisValue value ) : void

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

http://redis.io/commands/set

Set ( RedisKey key, RedisValue value, System.TimeSpan expiry ) : void

Set key to hold the string value and set key to timeout after a given number of seconds.

http://redis.io/commands/setex

SetAsync ( RedisValue>.Dictionary values ) : System.Threading.Tasks.Task

Sets the given keys to their respective values. MSET replaces existing values with new values, just as regular SET. See MSETNX if you don't want to overwrite existing values.

MSET is atomic, so all given keys are set at once. It is not possible for clients to see that some of the keys were updated while others are unchanged.http://redis.io/commands/mset

SetAsync ( RedisKey key, RedisValue value ) : System.Threading.Tasks.Task

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

http://redis.io/commands/set

SetAsync ( RedisKey key, RedisValue value, System.TimeSpan expiry ) : System.Threading.Tasks.Task

Set key to hold the string value and set key to timeout after a given number of seconds.

http://redis.io/commands/setex

SetAsync ( RedisKey key, long offset, RedisValue value ) : Task

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.

Note that the maximum offset that you can set is 229 -1 (536870911), as Redis Strings are limited to 512 megabytes. If you need to grow beyond this size, you can use multiple keys.

Warning: When setting the last possible byte and the string value stored at key does not yet hold a string value, or holds a small string value, Redis needs to allocate all intermediate memory which can block the server for some time. On a 2010 MacBook Pro, setting byte number 536870911 (512MB allocation) takes ~300ms, setting byte number 134217728 (128MB allocation) takes ~80ms, setting bit number 33554432 (32MB allocation) takes ~30ms and setting bit number 8388608 (8MB allocation) takes ~8ms. Note that once this first allocation is done, subsequent calls to SETRANGE for the same key will not have the allocation overhead.

http://redis.io/commands/setrange
SetBit ( RedisKey key, long offset, bool value ) : bool

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. The offset argument is required to be greater than or equal to 0, and smaller than 232 (this limits bitmaps to 512MB). When the string at key is grown, added bits are set to 0.

Warning: When setting the last possible bit (offset equal to 232 -1) and the string value stored at key does not yet hold a string value, or holds a small string value, Redis needs to allocate all intermediate memory which can block the server for some time. On a 2010 MacBook Pro, setting bit number 232 -1 (512MB allocation) takes ~300ms, setting bit number 230 -1 (128MB allocation) takes ~80ms, setting bit number 228 -1 (32MB allocation) takes ~30ms and setting bit number 226 -1 (8MB allocation) takes ~8ms. Note that once this first allocation is done, subsequent calls to SETBIT for the same key will not have the allocation overhead.

http://redis.io/commands/setbit
SetBitAsync ( RedisKey key, long offset, bool value ) : Task

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. The offset argument is required to be greater than or equal to 0, and smaller than 232 (this limits bitmaps to 512MB). When the string at key is grown, added bits are set to 0.

Warning: When setting the last possible bit (offset equal to 232 -1) and the string value stored at key does not yet hold a string value, or holds a small string value, Redis needs to allocate all intermediate memory which can block the server for some time. On a 2010 MacBook Pro, setting bit number 232 -1 (512MB allocation) takes ~300ms, setting bit number 230 -1 (128MB allocation) takes ~80ms, setting bit number 228 -1 (32MB allocation) takes ~30ms and setting bit number 226 -1 (8MB allocation) takes ~8ms. Note that once this first allocation is done, subsequent calls to SETBIT for the same key will not have the allocation overhead.

http://redis.io/commands/setbit
SetIfNotExists ( RedisValue>.Dictionary values ) : bool

Sets the given keys to their respective values. MSETNX will not perform any operation at all even if just a single key already exists.

Because of this semantic MSETNX can be used in order to set different keys representing different fields of an unique logic object in a way that ensures that either all the fields or none at all are set.

MSETNX is atomic, so all given keys are set at once. It is not possible for clients to see that some of the keys were updated while others are unchanged.

http://redis.io/commands/msetnx
SetIfNotExists ( RedisKey key, RedisValue value ) : bool

Set key to hold string value if key does not exist. In that case, it is equal to SET. When key already holds a value, no operation is performed.

http://redis.io/commands/setnx

SetIfNotExistsAsync ( RedisValue>.Dictionary values ) : Task

Sets the given keys to their respective values. MSETNX will not perform any operation at all even if just a single key already exists.

Because of this semantic MSETNX can be used in order to set different keys representing different fields of an unique logic object in a way that ensures that either all the fields or none at all are set.

MSETNX is atomic, so all given keys are set at once. It is not possible for clients to see that some of the keys were updated while others are unchanged.

http://redis.io/commands/msetnx
SetIfNotExistsAsync ( RedisKey key, RedisValue value ) : Task

Set key to hold string value if key does not exist. In that case, it is equal to SET. When key already holds a value, no operation is performed.

http://redis.io/commands/setnx

TakeLock ( RedisKey key, RedisValue value, System.TimeSpan expiry ) : bool

This is a composite helper command, to help with using redis as a lock provider. This is achieved as a RedisKey key/value pair with timeout. If the lock does not exist (or has expired), then a new RedisKey key is created (with the supplied duration), and true is returned to indicate success. If the lock already exists, then no lock is taken, and false is returned. The value may be fetched separately, but the meaning is implementation-defined). No change is made if the lock was not successfully taken. In this case, the client should delay and retry.

It is expected that a well-behaved client will also release the lock in a timely fashion via ReleaseLockAsync.

It transpires that robust locking in redis is actually remarkably hard, and most implementations are broken in one way or another (most commonly: thread-race, or extending the lock duration when failing to take the lock).

TakeLockAsync ( RedisKey key, RedisValue value, System.TimeSpan expiry ) : Task

This is a composite helper command, to help with using redis as a lock provider. This is achieved as a RedisKey key/value pair with timeout. If the lock does not exist (or has expired), then a new RedisKey key is created (with the supplied duration), and true is returned to indicate success. If the lock already exists, then no lock is taken, and false is returned. The value may be fetched separately, but the meaning is implementation-defined). No change is made if the lock was not successfully taken. In this case, the client should delay and retry.

It is expected that a well-behaved client will also release the lock in a timely fashion via ReleaseLockAsync.

It transpires that robust locking in redis is actually remarkably hard, and most implementations are broken in one way or another (most commonly: thread-race, or extending the lock duration when failing to take the lock).

Method Details

Append() public static method

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.
http://redis.io/commands/append
public static Append ( RedisKey key, RedisValue value ) : long
key RedisKey /// The key. ///
value RedisValue /// The value. ///
return long

Append() public static method

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.
http://redis.io/commands/append
public static Append ( RedisKey key, byte value ) : long
key RedisKey /// The key. ///
value byte /// The value. ///
return long

AppendAsync() public static method

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.
http://redis.io/commands/append
public static AppendAsync ( RedisKey key, RedisValue value ) : Task
key RedisKey /// The key. ///
value RedisValue /// The value. ///
return Task

AppendAsync() public static method

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.
http://redis.io/commands/append
public static AppendAsync ( RedisKey key, byte value ) : Task
key RedisKey /// The key. ///
value byte /// The value. ///
return Task

CountSetBits() public static method

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.

http://redis.io/commands/bitcount
public static CountSetBits ( RedisKey key, long start, long end = -1 ) : long
key RedisKey /// The key. ///
start long /// The start. ///
end long /// The end. ///
return long

CountSetBitsAsync() public static method

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.

http://redis.io/commands/bitcount
public static CountSetBitsAsync ( RedisKey key, long start, long end = -1 ) : Task
key RedisKey /// The key. ///
start long /// The start. ///
end long /// The end. ///
return Task

Decrement() public static method

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.
http://redis.io/commands/decrby http://redis.io/commands/decr
public static Decrement ( RedisKey key, long value = 1 ) : long
key RedisKey /// The key. ///
value long /// The value. ///
return long

DecrementAsync() public static method

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.
http://redis.io/commands/decrby http://redis.io/commands/decr
public static DecrementAsync ( RedisKey key, long value = 1 ) : Task
key RedisKey /// The key. ///
value long /// The value. ///
return Task

Get() public static method

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.
http://redis.io/commands/get
public static Get ( RedisKey key ) : RedisValue
key RedisKey /// The key. ///
return RedisValue

Get() public static method

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.
http://redis.io/commands/get
public static Get ( RedisKey key, System.TimeSpan expire ) : RedisValue
key RedisKey /// The key. ///
expire System.TimeSpan /// The expire. ///
return RedisValue

Get() public static method

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. The function handles out of range requests by limiting the resulting range to the actual length of the string. http://redis.io/commands/getrange
public static Get ( RedisKey key, int start, int end ) : RedisValue
key RedisKey /// The key. ///
start int /// The start. ///
end int /// The end. ///
return RedisValue

Get() public static method

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. Because of this, the operation never fails.
http://redis.io/commands/mget
public static Get ( RedisKey keys ) : RedisValue[]
keys RedisKey /// The keys. ///
return RedisValue[]

GetAsync() public static method

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.
http://redis.io/commands/get
public static GetAsync ( RedisKey key ) : Task
key RedisKey /// The key. ///
return Task

GetAsync() public static method

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.
http://redis.io/commands/get
public static GetAsync ( RedisKey key, System.TimeSpan expire ) : Task
key RedisKey /// The key. ///
expire System.TimeSpan /// The expire. ///
return Task

GetAsync() public static method

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. The function handles out of range requests by limiting the resulting range to the actual length of the string. http://redis.io/commands/getrange
public static GetAsync ( RedisKey key, int start, int end ) : Task
key RedisKey /// The key. ///
start int /// The start. ///
end int /// The end. ///
return Task

GetAsync() public static method

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. Because of this, the operation never fails.
http://redis.io/commands/mget
public static GetAsync ( RedisKey keys ) : Task
keys RedisKey /// The keys. ///
return Task

GetBit() public static method

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. When key does not exist it is assumed to be an empty string, so offset is always out of range and the value is also assumed to be a contiguous space with 0 bits. http://redis.io/commands/getbit
public static GetBit ( RedisKey key, long offset ) : bool
key RedisKey /// The key. ///
offset long /// The offset. ///
return bool

GetBitAsync() public static method

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. When key does not exist it is assumed to be an empty string, so offset is always out of range and the value is also assumed to be a contiguous space with 0 bits. http://redis.io/commands/getbit
public static GetBitAsync ( RedisKey key, long offset ) : Task
key RedisKey /// The key. ///
offset long /// The offset. ///
return Task

GetLength() public static method

Returns the length of the string value stored at key. An error is returned when key holds a non-string value.
http://redis.io/commands/strlen
public static GetLength ( RedisKey key ) : long
key RedisKey /// The key. ///
return long

GetLengthAsync() public static method

Returns the length of the string value stored at key. An error is returned when key holds a non-string value.
http://redis.io/commands/strlen
public static GetLengthAsync ( RedisKey key ) : Task
key RedisKey /// The key. ///
return Task

GetSet() public static method

Atomically sets key to value and returns the old value stored at key. Returns an error when key exists but does not hold a string value.
http://redis.io/commands/getset
public static GetSet ( RedisKey key, RedisValue value ) : RedisValue
key RedisKey /// The key. ///
value RedisValue /// The value. ///
return RedisValue

GetSet() public static method

Atomically sets key to value and returns the old value stored at key. Returns an error when key exists but does not hold a string value.
http://redis.io/commands/getset
public static GetSet ( RedisKey key, RedisValue value, System.TimeSpan expire ) : RedisValue
key RedisKey /// The key. ///
value RedisValue /// The value. ///
expire System.TimeSpan /// An expiration lifetime. ///
return RedisValue

GetSetAsync() public static method

Atomically sets key to value and returns the old value stored at key. Returns an error when key exists but does not hold a string value.
http://redis.io/commands/getset
public static GetSetAsync ( RedisKey key, RedisValue value ) : Task
key RedisKey /// The key. ///
value RedisValue /// The value. ///
return Task

GetSetAsync() public static method

Atomically sets key to value and returns the old value stored at key. Returns an error when key exists but does not hold a string value.
http://redis.io/commands/getset
public static GetSetAsync ( RedisKey key, RedisValue value, System.TimeSpan expire ) : Task
key RedisKey /// The key. ///
value RedisValue /// The value. ///
expire System.TimeSpan /// An expiration lifetime. ///
return Task

Increment() public static method

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.
http://redis.io/commands/incrby http://redis.io/commands/incr
public static Increment ( RedisKey key, long value = 1 ) : long
key RedisKey /// The key. ///
value long /// The value. ///
return long

IncrementAsync() public static method

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.
http://redis.io/commands/incrby http://redis.io/commands/incr
public static IncrementAsync ( RedisKey key, long value = 1 ) : Task
key RedisKey /// The key. ///
value long /// The value. ///
return Task

ReleaseLock() public static method

Releases a lock that was taken successfully via TakeLock. You should not release a lock that you did not take, as this will cause problems.
public static ReleaseLock ( RedisKey key, RedisValue value ) : void
key RedisKey /// The key. ///
value RedisValue /// The value. ///
return void

ReleaseLockAsync() public static method

Releases a lock that was taken successfully via TakeLock. You should not release a lock that you did not take, as this will cause problems.
public static ReleaseLockAsync ( RedisKey key, RedisValue value ) : System.Threading.Tasks.Task
key RedisKey /// The key. ///
value RedisValue /// The value. ///
return System.Threading.Tasks.Task

Set() public static method

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.
Note that the maximum offset that you can set is 229 -1 (536870911), as Redis Strings are limited to 512 megabytes. If you need to grow beyond this size, you can use multiple keys.

Warning: When setting the last possible byte and the string value stored at key does not yet hold a string value, or holds a small string value, Redis needs to allocate all intermediate memory which can block the server for some time. On a 2010 MacBook Pro, setting byte number 536870911 (512MB allocation) takes ~300ms, setting byte number 134217728 (128MB allocation) takes ~80ms, setting bit number 33554432 (32MB allocation) takes ~30ms and setting bit number 8388608 (8MB allocation) takes ~8ms. Note that once this first allocation is done, subsequent calls to SETRANGE for the same key will not have the allocation overhead.

http://redis.io/commands/setrange
public static Set ( RedisKey key, long offset, RedisValue value ) : RedisValue
key RedisKey /// The key. ///
offset long /// The offset. ///
value RedisValue /// The value. ///
return RedisValue

Set() public static method

Sets the given keys to their respective values. MSET replaces existing values with new values, just as regular SET. See MSETNX if you don't want to overwrite existing values.
MSET is atomic, so all given keys are set at once. It is not possible for clients to see that some of the keys were updated while others are unchanged. http://redis.io/commands/mset
public static Set ( RedisValue>.Dictionary values ) : void
values RedisValue>.Dictionary /// A collection of key-value pairs to be set. ///
return void

Set() public static method

Set key to hold the string value. If key already holds a value, it is overwritten, regardless of its type.
http://redis.io/commands/set
public static Set ( RedisKey key, RedisValue value ) : void
key RedisKey /// The key. ///
value RedisValue /// The value. ///
return void

Set() public static method

Set key to hold the string value and set key to timeout after a given number of seconds.
http://redis.io/commands/setex
public static Set ( RedisKey key, RedisValue value, System.TimeSpan expiry ) : void
key RedisKey /// The key. ///
value RedisValue /// The value. ///
expiry System.TimeSpan /// An expiration lifetime. ///
return void

SetAsync() public static method

Sets the given keys to their respective values. MSET replaces existing values with new values, just as regular SET. See MSETNX if you don't want to overwrite existing values.
MSET is atomic, so all given keys are set at once. It is not possible for clients to see that some of the keys were updated while others are unchanged. http://redis.io/commands/mset
public static SetAsync ( RedisValue>.Dictionary values ) : System.Threading.Tasks.Task
values RedisValue>.Dictionary /// A collection of key-value pairs to be set. ///
return System.Threading.Tasks.Task

SetAsync() public static method

Set key to hold the string value. If key already holds a value, it is overwritten, regardless of its type.
http://redis.io/commands/set
public static SetAsync ( RedisKey key, RedisValue value ) : System.Threading.Tasks.Task
key RedisKey /// The key. ///
value RedisValue /// The value. ///
return System.Threading.Tasks.Task

SetAsync() public static method

Set key to hold the string value and set key to timeout after a given number of seconds.
http://redis.io/commands/setex
public static SetAsync ( RedisKey key, RedisValue value, System.TimeSpan expiry ) : System.Threading.Tasks.Task
key RedisKey /// The key. ///
value RedisValue /// The value. ///
expiry System.TimeSpan /// An expiration lifetime. ///
return System.Threading.Tasks.Task

SetAsync() public static method

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.
Note that the maximum offset that you can set is 229 -1 (536870911), as Redis Strings are limited to 512 megabytes. If you need to grow beyond this size, you can use multiple keys.

Warning: When setting the last possible byte and the string value stored at key does not yet hold a string value, or holds a small string value, Redis needs to allocate all intermediate memory which can block the server for some time. On a 2010 MacBook Pro, setting byte number 536870911 (512MB allocation) takes ~300ms, setting byte number 134217728 (128MB allocation) takes ~80ms, setting bit number 33554432 (32MB allocation) takes ~30ms and setting bit number 8388608 (8MB allocation) takes ~8ms. Note that once this first allocation is done, subsequent calls to SETRANGE for the same key will not have the allocation overhead.

http://redis.io/commands/setrange
public static SetAsync ( RedisKey key, long offset, RedisValue value ) : Task
key RedisKey /// The key. ///
offset long /// The offset. ///
value RedisValue /// The value. ///
return Task

SetBit() public static method

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. The offset argument is required to be greater than or equal to 0, and smaller than 232 (this limits bitmaps to 512MB). When the string at key is grown, added bits are set to 0.

Warning: When setting the last possible bit (offset equal to 232 -1) and the string value stored at key does not yet hold a string value, or holds a small string value, Redis needs to allocate all intermediate memory which can block the server for some time. On a 2010 MacBook Pro, setting bit number 232 -1 (512MB allocation) takes ~300ms, setting bit number 230 -1 (128MB allocation) takes ~80ms, setting bit number 228 -1 (32MB allocation) takes ~30ms and setting bit number 226 -1 (8MB allocation) takes ~8ms. Note that once this first allocation is done, subsequent calls to SETBIT for the same key will not have the allocation overhead.

http://redis.io/commands/setbit
public static SetBit ( RedisKey key, long offset, bool value ) : bool
key RedisKey /// The key. ///
offset long /// The offset. ///
value bool /// The value. ///
return bool

SetBitAsync() public static method

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. The offset argument is required to be greater than or equal to 0, and smaller than 232 (this limits bitmaps to 512MB). When the string at key is grown, added bits are set to 0.

Warning: When setting the last possible bit (offset equal to 232 -1) and the string value stored at key does not yet hold a string value, or holds a small string value, Redis needs to allocate all intermediate memory which can block the server for some time. On a 2010 MacBook Pro, setting bit number 232 -1 (512MB allocation) takes ~300ms, setting bit number 230 -1 (128MB allocation) takes ~80ms, setting bit number 228 -1 (32MB allocation) takes ~30ms and setting bit number 226 -1 (8MB allocation) takes ~8ms. Note that once this first allocation is done, subsequent calls to SETBIT for the same key will not have the allocation overhead.

http://redis.io/commands/setbit
public static SetBitAsync ( RedisKey key, long offset, bool value ) : Task
key RedisKey /// The key. ///
offset long /// The offset. ///
value bool /// The value. ///
return Task

SetIfNotExists() public static method

Sets the given keys to their respective values. MSETNX will not perform any operation at all even if just a single key already exists.
Because of this semantic MSETNX can be used in order to set different keys representing different fields of an unique logic object in a way that ensures that either all the fields or none at all are set.

MSETNX is atomic, so all given keys are set at once. It is not possible for clients to see that some of the keys were updated while others are unchanged.

http://redis.io/commands/msetnx
public static SetIfNotExists ( RedisValue>.Dictionary values ) : bool
values RedisValue>.Dictionary /// A collection of key-value pairs to be set. ///
return bool

SetIfNotExists() public static method

Set key to hold string value if key does not exist. In that case, it is equal to SET. When key already holds a value, no operation is performed.
http://redis.io/commands/setnx
public static SetIfNotExists ( RedisKey key, RedisValue value ) : bool
key RedisKey /// The key. ///
value RedisValue /// The value. ///
return bool

SetIfNotExistsAsync() public static method

Sets the given keys to their respective values. MSETNX will not perform any operation at all even if just a single key already exists.
Because of this semantic MSETNX can be used in order to set different keys representing different fields of an unique logic object in a way that ensures that either all the fields or none at all are set.

MSETNX is atomic, so all given keys are set at once. It is not possible for clients to see that some of the keys were updated while others are unchanged.

http://redis.io/commands/msetnx
public static SetIfNotExistsAsync ( RedisValue>.Dictionary values ) : Task
values RedisValue>.Dictionary /// A collection of key-value pairs to be set. ///
return Task

SetIfNotExistsAsync() public static method

Set key to hold string value if key does not exist. In that case, it is equal to SET. When key already holds a value, no operation is performed.
http://redis.io/commands/setnx
public static SetIfNotExistsAsync ( RedisKey key, RedisValue value ) : Task
key RedisKey /// The key. ///
value RedisValue /// The value. ///
return Task

TakeLock() public static method

This is a composite helper command, to help with using redis as a lock provider. This is achieved as a RedisKey key/value pair with timeout. If the lock does not exist (or has expired), then a new RedisKey key is created (with the supplied duration), and true is returned to indicate success. If the lock already exists, then no lock is taken, and false is returned. The value may be fetched separately, but the meaning is implementation-defined). No change is made if the lock was not successfully taken. In this case, the client should delay and retry.

It is expected that a well-behaved client will also release the lock in a timely fashion via ReleaseLockAsync.

It transpires that robust locking in redis is actually remarkably hard, and most implementations are broken in one way or another (most commonly: thread-race, or extending the lock duration when failing to take the lock).
public static TakeLock ( RedisKey key, RedisValue value, System.TimeSpan expiry ) : bool
key RedisKey /// The key. ///
value RedisValue /// The value. ///
expiry System.TimeSpan /// An expiration lifetime. ///
return bool

TakeLockAsync() public static method

This is a composite helper command, to help with using redis as a lock provider. This is achieved as a RedisKey key/value pair with timeout. If the lock does not exist (or has expired), then a new RedisKey key is created (with the supplied duration), and true is returned to indicate success. If the lock already exists, then no lock is taken, and false is returned. The value may be fetched separately, but the meaning is implementation-defined). No change is made if the lock was not successfully taken. In this case, the client should delay and retry.

It is expected that a well-behaved client will also release the lock in a timely fashion via ReleaseLockAsync.

It transpires that robust locking in redis is actually remarkably hard, and most implementations are broken in one way or another (most commonly: thread-race, or extending the lock duration when failing to take the lock).
public static TakeLockAsync ( RedisKey key, RedisValue value, System.TimeSpan expiry ) : Task
key RedisKey /// The key. ///
value RedisValue /// The value. ///
expiry System.TimeSpan /// An expiration lifetime. ///
return Task