Closed
Description
Can RedisDBOptions add the KeyPrefix attribute to enable?
/// <summary>
/// Redis cache options.
/// </summary>
public class RedisDBOptions : BaseRedisOptions
{
.....
/// <summary>
/// Gets or sets the Redis database KeyPrefix will use.
/// </summary>
public string KeyPrefix { get; set; }
}
// RedisDatabaseProvider
/// <summary>
/// Gets the database connection.
/// </summary>
public IDatabase GetDatabase()
{
try
{
var database = _connectionMultiplexer.Value.GetDatabase();
if (!string.IsNullOrEmpty(_options.KeyPrefix))
database = database.WithKeyPrefix(_options.KeyPrefix);
return database;
}
catch (Exception)
{
_connectionMultiplexer = new Lazy<ConnectionMultiplexer>(CreateConnectionMultiplexer);
throw;
}
}