新增缓存删除Hash数据方法

This commit is contained in:
RuoYi 2022-03-26 17:26:54 +08:00
parent 76f0851fc9
commit c19bb1e75d

View File

@ -15,7 +15,7 @@ import org.springframework.stereotype.Component;
/** /**
* spring redis 工具类 * spring redis 工具类
* *
* @author ruoyi * @author ruoyi
**/ **/
@SuppressWarnings(value = { "unchecked", "rawtypes" }) @SuppressWarnings(value = { "unchecked", "rawtypes" })
@ -111,7 +111,7 @@ public class RedisCache
* 缓存List数据 * 缓存List数据
* *
* @param key 缓存的键值 * @param key 缓存的键值
* @param values 待缓存的List数据 * @param dataList 待缓存的List数据
* @return 缓存的对象 * @return 缓存的对象
*/ */
public <T> long setCacheList(final String key, final List<T> dataList) public <T> long setCacheList(final String key, final List<T> dataList)
@ -209,6 +209,18 @@ public class RedisCache
return opsForHash.get(key, hKey); return opsForHash.get(key, hKey);
} }
/**
* 删除Hash中的数据
*
* @param key
* @param hKey
*/
public void delCacheMapValue(final String key, final String hKey)
{
HashOperations hashOperations = redisTemplate.opsForHash();
hashOperations.delete(key, hKey);
}
/** /**
* 获取多个Hash中的数据 * 获取多个Hash中的数据
* *
@ -223,7 +235,7 @@ public class RedisCache
/** /**
* 获得缓存的基本对象列表 * 获得缓存的基本对象列表
* *
* @param pattern 字符串前缀 * @param pattern 字符串前缀
* @return 对象列表 * @return 对象列表
*/ */