Remove/Delete all/one item from StackExchange.Redis cache

前端 未结 4 540
执念已碎
执念已碎 2021-01-31 14:54

I am using StackExchange.Redis client with Azure Redis Cache Service. Here is my class,

public class RedisCacheService : ICacheService
{
    private readonly ISe         


        
4条回答
  •  长情又很酷
    2021-01-31 15:15

    You can delete hash as well ie if you want to clear specific value from any cached list. For example, we have an emp list and inside with different department as cached.

    public static void DeleteHash(string key, string cacheSubKey)
            {
                if (string.IsNullOrEmpty(key))
                    throw new ArgumentNullException("key");
    
                Cache.HashDelete(key, cacheSubKey);
            }
    

    so you can pass Key name and cache subkey as well.

提交回复
热议问题