Class DatabaseExtensions
- Namespace
- StackExchange.Redis.KeyspaceIsolation
- Assembly
- StackExchange.Redis.StrongName.dll
Provides the WithKeyPrefix(IDatabase, RedisKey) extension method to IDatabase.
public static class DatabaseExtensions
- Inheritance
-
DatabaseExtensions
- Inherited Members
Methods
WithKeyPrefix(IDatabase, RedisKey)
Creates a new IDatabase instance that provides an isolated key space of the specified underyling database instance.
public static IDatabase WithKeyPrefix(this IDatabase database, RedisKey keyPrefix)
Parameters
database
IDatabaseThe underlying database instance that the returned instance shall use.
keyPrefix
RedisKeyThe prefix that defines a key space isolation for the returned database instance.
Returns
- IDatabase
A new IDatabase instance that invokes the specified underlying
database
but prepends the specifiedkeyPrefix
to all key paramters and thus forms a logical key space isolation.
Remarks
The following methods are not supported in a key space isolated database and will throw an NotSupportedException when invoked:
Please notice that keys passed to a script are prefixed (as normal) but care must be taken when a script returns the name of a key as that will (currently) not be "unprefixed".