diff --git a/src/main/java/com/ruoyi/framework/redis/RedisCache.java b/src/main/java/com/ruoyi/framework/redis/RedisCache.java index 1e674db..da5329a 100644 --- a/src/main/java/com/ruoyi/framework/redis/RedisCache.java +++ b/src/main/java/com/ruoyi/framework/redis/RedisCache.java @@ -61,6 +61,19 @@ public class RedisCache return expire(key, timeout, TimeUnit.SECONDS); } + /** + * 设置有效时间 + * + * @param key Redis键 + * @param timeout 超时时间 + * @param unit 时间单位 + * @return true=设置成功;false=设置失败 + */ + public boolean expire(final String key, final long timeout, final TimeUnit unit) + { + return redisTemplate.expire(key, timeout, unit); + } + /** * 获取有效时间 * @@ -83,19 +96,6 @@ public class RedisCache return redisTemplate.hasKey(key); } - /** - * 设置有效时间 - * - * @param key Redis键 - * @param timeout 超时时间 - * @param unit 时间单位 - * @return true=设置成功;false=设置失败 - */ - public boolean expire(final String key, final long timeout, final TimeUnit unit) - { - return redisTemplate.expire(key, timeout, unit); - } - /** * 获得缓存的基本对象。 * @@ -255,6 +255,18 @@ public class RedisCache return redisTemplate.opsForHash().multiGet(key, hKeys); } + /** + * 删除Hash中的某条数据 + * + * @param key Redis键 + * @param hKey Hash键 + * @return 是否成功 + */ + public boolean deleteCacheMapValue(final String key, final String hKey) + { + return Boolean.TRUE.equals(redisTemplate.opsForHash().delete(key, hKey)); + } + /** * 获得缓存的基本对象列表 *