public List <string> GetMatchedKeys(IRedisKey key = null) { var matchedKeys = new List <string>(); foreach (var end in _endPoints) { var server = Multiplexer.GetServer(end); if (key is null) { // we get all key from database foreach (var k in server.Keys(pattern: "*", database: Db.Database)) { matchedKeys.Add(k); } } else { // we get specific key from database foreach (var k in server.Keys(pattern: key.SearchKey, database: Db.Database)) { matchedKeys.Add(k); } } } return(matchedKeys); }
public TValue GetValue(IRedisKey key) { var value = Db.StringGet(key.FullKey); if (value.IsNull) { return(default);
/// <summary> /// Get matched key value by key from database. /// if key is null this will get all key value from database /// </summary> /// <param name="key"></param> /// <returns></returns> public Dictionary <string, TValue> GetKeyValues(IRedisKey key = null) { var dict = new Dictionary <string, TValue>(); var keys = GetMatchedKeys(key); foreach (var k in keys) { dict.Add(k, JsonConvert.DeserializeObject <TValue>(Db.StringGet(k.ToString()))); } return(dict); }
public void Dispose() { redisHash = null; redisKey = null; redisList = null; redisLock = null; redisSet = null; redisSortedSet = null; redisStore = null; redisString = null; redisSubscribe = null; }
public IRedisKeyTests() { _provider = new StackExchangeRedisProvider(RedisConnStr); }
public IRedisKeyTests() { _provider = RedisFactory.GetProvider(); }