diff --git a/src/main/java/com/m2pool/lease/redis/service/RedisService.java b/src/main/java/com/m2pool/lease/redis/service/RedisService.java index a59b174..2b1656b 100644 --- a/src/main/java/com/m2pool/lease/redis/service/RedisService.java +++ b/src/main/java/com/m2pool/lease/redis/service/RedisService.java @@ -274,6 +274,47 @@ public class RedisService { redisTemplate.opsForHash().put(key, hKey, value); } + + + /** + * 往Hash中存入数据 + * + * @param key Redis键 + * @param hKey Hash键 + * @param value 值 + */ + public void setCacheMapValue7(final String key, final String hKey, final T value) + { + redisTemplate7.opsForHash().put(key, hKey, value); + } + + /** + * 往Hash中存入数据(带过期时间) + * + * @param key Redis键 + * @param hKey Hash键 + * @param value 值 + * @param timeout 过期时间 + * @param timeUnit 时间单位 + */ + public void setCacheMapValue7(final String key, final String hKey, final T value, final Long timeout, final TimeUnit timeUnit) + { + redisTemplate7.opsForHash().put(key, hKey, value); + redisTemplate7.expire(key, timeout, timeUnit); + } + + /** + * 删除Hash中的数据(批量删除) + * + * @param keyFieldMap Redis键和Hash键的映射,key=Redis键,value=Hash键 + */ + public void deleteCacheMapValue7(final Map keyFieldMap) { + keyFieldMap.forEach((key, hKey) -> { + redisTemplate7.opsForHash().delete(key, hKey); + }); + } + + /** * 获取Hash中的数据 *