Class
RedisStorage

IStorage implementation using Redis server (redis.io).

Definition

Namespace:Telerik.Reporting.Cache.StackExchangeRedis

Assembly:Telerik.Reporting.Cache.StackExchangeRedis.dll

Syntax:

cs-api-definition
public class RedisStorage : IStorage

Inheritance: objectRedisStorage

Implements: IStorage

Constructors

RedisStorage(ConnectionMultiplexer)

Initializes a new instance of the RedisStorage class.

Declaration

cs-api-definition
public RedisStorage(ConnectionMultiplexer connection)

Parameters

connection

ConnectionMultiplexer

An object hiding the Redis connection details. Should be reused (static/ shared) for each request.

RedisStorage(ConnectionMultiplexer, string)

Initializes a new instance of the RedisStorage class.

Declaration

cs-api-definition
public RedisStorage(ConnectionMultiplexer connection, string keysPrefix)

Parameters

connection

ConnectionMultiplexer

An object hiding the Redis connection details. Should be reused (static/ shared) for each request.

keysPrefix

string

String prefix that should be applied on each key stored in the Redis database. This allows shared usage of one Redis database.

RedisStorage(ConnectionMultiplexer, string, int)

Initializes a new instance of the RedisStorage class.

Declaration

cs-api-definition
[Obsolete("This constructor is now obsolete. Instantiate a ConnectionMultiplexer using a ConfigurationOptions with defaultDatabase key set.")]
public RedisStorage(ConnectionMultiplexer connection, string keysPrefix, int databaseNumber)

Parameters

connection

ConnectionMultiplexer

An object hiding the Redis connection details. Should be reused (static/ shared) for each request.

keysPrefix

string

String prefix that should be applied on each key stored in the Redis database. This allows shared usage of one Redis database.

databaseNumber

int

Determines the number of the database that should be used.

Properties

LockTimeout

Gets or sets the acquired lock timeout in seconds. When expired, lock is released. Default timeout is 3 seconds.

Declaration

cs-api-definition
public int LockTimeout { get; set; }

Property Value

int

Methods

AcquireLock(string)

Acquires a lock on a named resource.

Declaration

cs-api-definition
public IDisposable AcquireLock(string key)

Parameters

key

string

Returns

IDisposable

Implements IStorage.AcquireLock(string)

AcquireReadLock(string)

Acquires a lock on a named resource for reading, using less-restrictive locking mechanism.

Declaration

cs-api-definition
public IDisposable AcquireReadLock(string key)

Parameters

key

string

Returns

IDisposable

Implements IStorage.AcquireReadLock(string)

Remarks

Acquires a lock on a named resource and returns a disposable lock object. When the lock object owner disposes it, the lock is released.

AddInSet(string, string)

Adds a single string value to a set of values denoted from the given key.

Declaration

cs-api-definition
public void AddInSet(string key, string value)

Parameters

key

string

value

string

Implements IStorage.AddInSet(string, string)

Delete(string)

Deletes a key with its value (string or byte array) from the storage.

Declaration

cs-api-definition
public void Delete(string key)

Parameters

key

string

Implements IStorage.Delete(string)

DeleteInSet(string, string)

Deletes a single string value from a set of values denoted from the given key.

Declaration

cs-api-definition
public bool DeleteInSet(string key, string value)

Parameters

key

string

value

string

Returns

bool

Implements IStorage.DeleteInSet(string, string)

DeleteSet(string)

Deletes a key with its values from the storage.

Declaration

cs-api-definition
public void DeleteSet(string key)

Parameters

key

string

Implements IStorage.DeleteSet(string)

Exists(string)

Retrieves a value indicating if a single value (string or byte array) exists in the storage.

Declaration

cs-api-definition
public bool Exists(string key)

Parameters

key

string

Returns

bool

Implements IStorage.Exists(string)

ExistsInSet(string, string)

Retrieves a value indicating if a set of values exists in the storage.

Declaration

cs-api-definition
public bool ExistsInSet(string key, string value)

Parameters

key

string

value

string

Returns

bool

Implements IStorage.ExistsInSet(string, string)

GetAllMembersInSet(string)

Retrieves all members in a set of string values.

Declaration

cs-api-definition
public IEnumerable<string> GetAllMembersInSet(string key)

Parameters

key

string

Returns

IEnumerable<string>

Implements IStorage.GetAllMembersInSet(string)

GetBytes(string)

Retrieves a byte array value stored under particular key.

Declaration

cs-api-definition
public byte[] GetBytes(string key)

Parameters

key

string

Returns

byte[]

Implements IStorage.GetBytes(string)

GetCountInSet(string)

Retrieves the count of the values in a set value stored in the storage.

Declaration

cs-api-definition
public long GetCountInSet(string key)

Parameters

key

string

Returns

long

Implements IStorage.GetCountInSet(string)

GetString(string)

Retrieves a string value stored under particular key.

Declaration

cs-api-definition
public string GetString(string key)

Parameters

key

string

Returns

string

Implements IStorage.GetString(string)

SetBytes(string, byte[])

Stores a byte array value under particular key.

Declaration

cs-api-definition
public void SetBytes(string key, byte[] value)

Parameters

key

string

value

byte[]

Implements IStorage.SetBytes(string, byte[])

SetString(string, string)

Stores a string value under particular key.

Declaration

cs-api-definition
public void SetString(string key, string value)

Parameters

key

string

value

string

Implements IStorage.SetString(string, string)