新增删除Hash中的某条数据
This commit is contained in:
parent
efa29dd0bf
commit
1edc2fc69f
@ -61,6 +61,19 @@ public class RedisCache
|
|||||||
return expire(key, timeout, TimeUnit.SECONDS);
|
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);
|
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);
|
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));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获得缓存的基本对象列表
|
* 获得缓存的基本对象列表
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user