public T Get <T>(string key) { var redisUrl = _configuration["RedisUrl"]; using (var client = new RedisManagerPool(redisUrl).GetClient()) return(client.Get <T>(key)); }
private void RedisDownload(string blobName, string localFile) { var tempFile = Path.GetTempFileName(); try { var redisClient = new RedisManagerPool(_config["RedisStorage:ConnectionString"]) .GetClient(); System.IO.File.WriteAllBytes(tempFile, redisClient.Get <byte[]>(blobName)); } finally { System.IO.File.Delete(tempFile); } }
private void Get(IAbstractEntityHandler <TRequestDto, TEntity, TOut> handler) { if (!(handler is IRedisCacheQueryHandler) || handler.Context.HasErrors()) { return; } using (var client = new RedisManagerPool("localhost:6379").GetClient()) { //IRedisCacheHandler var key = ((IRedisCacheQueryHandler)handler).RedisKey(); handler.Context.Result = client.Get <TOut>(key); if (handler.Context.Result == null) { return; } if (!_redisContext.Keys.Contains(key)) { _redisContext.Keys.Add(key); } } }