public async Task<bool> UpdateTagsAsync(RedisClient client, IRedisCacheItem cacheItem)
        {
            await SetTagsForKeyAsync(client, cacheItem);
            await AddKeyToTagsAsync(client, cacheItem);

            return true;
        }
 public void UpdateTags(RedisClient client, string key, IEnumerable<string> tags)
 {
     var cacheItem = _cacheItemFactory.Generate(
         key: key,
         tags: tags == null ? null : tags.ToList()
     );
     UpdateTags(client, cacheItem);
 }
 public string[] GetKeysForTag(RedisClient client, string tag)
 {
     var keys = client.GetKeysForTag(tag);
     if (keys != null)
     {
         return keys.ToArray();
     }
     return null;
 }
 public async Task<string[]> GetKeysForTagAsync(RedisClient client, string tag)
 {
     var keys = await client.GetKeysForTagAsync(tag);
     if (keys != null)
     {
         return keys.ToArray();
     }
     return null;
 }
 private string[] GetTagsForKey(RedisClient client, string key)
 {
     var keys = client.GetTagsForKey(key);
     if (keys != null)
     {
         return keys.ToArray();
     }
     return null;
 }
        public async Task<bool> UpdateTagsAsync(RedisClient client, string key, IEnumerable<string> tags)
        {
            var cacheItem = _cacheItemFactory.Generate(
                key: key,
                tags: tags == null ? null : tags.ToList()
            );

            await UpdateTagsAsync(client, cacheItem);

            return true;
        }
 public void SetKeyExpiry(RedisClient client, string key, DateTime expiryDate)
 {
     client.SetTimeSet(SetKey, key, expiryDate);
 }
        public async Task<bool> SetTagsForKeyAsync(RedisClient client, IRedisCacheItem cacheItem)
        {
            if (cacheItem != null)
            {
                if (cacheItem.Tags != null && cacheItem.Tags.Any())
                {
                    await client.SetTagsForKeyAsync(cacheItem.Key, cacheItem.Tags);
                }
            }

            return true;
        }
 public void SetTagsForKey(RedisClient client, IRedisCacheItem cacheItem)
 {
     if (cacheItem != null)
     {
         if (cacheItem.Tags != null && cacheItem.Tags.Any())
         {
             client.SetTagsForKey(cacheItem.Key, cacheItem.Tags);
         }
     }
 }
 public void RemoveTags(RedisClient client, string[] keys)
 {
     foreach (var key in keys)
     {
         var tags = GetTagsForKey(client, key);
         var cacheItem = _cacheItemFactory.Generate(
             key: key,
             tags: tags.ToList()
             );
         RemoveKeyFromTags(client, cacheItem);
         RemoveTagsForKey(client, cacheItem);
     }
 }
 public void RemoveTags(RedisClient client, string key)
 {
     RemoveTags(client, new[] { key });
 }
        public async Task<bool> RemoveTagsAsync(RedisClient client, string[] keys)
        {
            foreach (var key in keys)
            {
                var tags = GetTagsForKey(client, key);
                var cacheItem = _cacheItemFactory.Generate(
                    key: key,
                    tags: tags.ToList()
                    );
                await RemoveKeyFromTagsAsync(client, cacheItem);
                await RemoveTagsForKeyAsync(client, cacheItem);
            }

            return true;
        }
 public string[] GetExpiredKeys(RedisClient client, DateTime maxDate)
 {
     return client.GetFromTimeSet(SetKey, maxDate);
 }
 public void RemoveKeyExpiry(RedisClient client, string[] keys)
 {
     client.RemoveTimeSet(SetKey, keys);
 }
        public async Task<bool> RemoveTagsAsync(RedisClient client, IRedisCacheItem cacheItem)
        {
            var remoteKeyTask = RemoveKeyFromTagsAsync(client, cacheItem);
            var removeTagTask = RemoveTagsForKeyAsync(client, cacheItem);

            return await remoteKeyTask && await removeTagTask;
        }
        public async Task<bool> RemoveKeyFromTagsAsync(RedisClient client, IRedisCacheItem cacheItem)
        {
            if (cacheItem != null)
            {
                if (cacheItem.Tags != null && cacheItem.Tags.Any())
                {
                    return await client.RemoveKeyFromTagsAsync(cacheItem.Key, cacheItem.Tags);
                }
            }

            return true;
        }
 public void RemoveKeyFromTags(RedisClient client, IRedisCacheItem cacheItem)
 {
     if (cacheItem != null)
     {
         if (cacheItem.Tags != null && cacheItem.Tags.Any())
         {
             client.RemoveKeyFromTags(cacheItem.Key, cacheItem.Tags);
         }
     }
 }
 public async Task<bool> RemoveKeyExpiryAsync(RedisClient client, string[] keys)
 {
     await client.RemoveTimeSetAsync(SetKey, keys);
     return true;
 }
 public void UpdateTags(RedisClient client, IRedisCacheItem cacheItem)
 {
     SetTagsForKey(client, cacheItem);
     AddKeyToTags(client, cacheItem);
 }
 public async Task<string[]> GetExpiredKeysAsync(RedisClient client, DateTime maxDate)
 {
     return await client.GetFromTimeSetAsync(SetKey, maxDate);
 }
 public void RemoveTags(RedisClient client, IRedisCacheItem cacheItem)
 {
     RemoveKeyFromTags(client, cacheItem);
     RemoveTagsForKey(client, cacheItem);
 }