New to Telerik ReportingStart a free 30-day trial

IStorage implementation using Redis server (redis.io).

Definition

Namespace:Telerik.Reporting.Cache.StackExchangeRedis

Assembly:Telerik.Reporting.Cache.StackExchangeRedis.dll

Syntax:

C#
public class RedisStorage : IStorage

Inheritance: objectRedisStorage

Implements: IStorage

Constructors

Initializes a new instance of the RedisStorage class.

C#
[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:connectionConnectionMultiplexer

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

keysPrefixstring

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

databaseNumberint

Determines the number of the database that should be used.

Initializes a new instance of the RedisStorage class.

C#
public RedisStorage(ConnectionMultiplexer connection, string keysPrefix)
Parameters:connectionConnectionMultiplexer

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

keysPrefixstring

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

Initializes a new instance of the RedisStorage class.

C#
public RedisStorage(ConnectionMultiplexer connection)
Parameters:connectionConnectionMultiplexer

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

Properties

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

C#
public int LockTimeout { get; set; }

Methods

Acquires a lock on a named resource.

C#
public IDisposable AcquireLock(string key)
Parameters:keystringReturns:

IDisposable

Implements: IStorage.AcquireLock(string)

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

C#
public IDisposable AcquireReadLock(string key)
Parameters:keystringReturns:

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.

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

C#
public void AddInSet(string key, string value)
Parameters:keystringvaluestring

Implements: IStorage.AddInSet(string, string)

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

C#
public void Delete(string key)
Parameters:keystring

Implements: IStorage.Delete(string)

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

C#
public bool DeleteInSet(string key, string value)
Parameters:keystringvaluestringReturns:

bool

Implements: IStorage.DeleteInSet(string, string)

Deletes a key with its values from the storage.

C#
public void DeleteSet(string key)
Parameters:keystring

Implements: IStorage.DeleteSet(string)

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

C#
public bool Exists(string key)
Parameters:keystringReturns:

bool

Implements: IStorage.Exists(string)

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

C#
public bool ExistsInSet(string key, string value)
Parameters:keystringvaluestringReturns:

bool

Implements: IStorage.ExistsInSet(string, string)

GetAllMembersInSet(string)

IEnumerable<string>

Retrieves all members in a set of string values.

C#
public IEnumerable<string> GetAllMembersInSet(string key)
Parameters:keystringReturns:

IEnumerable<string>

Implements: IStorage.GetAllMembersInSet(string)

Retrieves a byte array value stored under particular key.

C#
public byte[] GetBytes(string key)
Parameters:keystringReturns:

byte[]

Implements: IStorage.GetBytes(string)

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

C#
public long GetCountInSet(string key)
Parameters:keystringReturns:

long

Implements: IStorage.GetCountInSet(string)

Retrieves a string value stored under particular key.

C#
public string GetString(string key)
Parameters:keystringReturns:

string

Implements: IStorage.GetString(string)

Stores a byte array value under particular key.

C#
public void SetBytes(string key, byte[] value)
Parameters:keystringvaluebyte[]

Implements: IStorage.SetBytes(string, byte[])

Stores a string value under particular key.

C#
public void SetString(string key, string value)
Parameters:keystringvaluestring

Implements: IStorage.SetString(string, string)