redis del清除缓存java_redis zset集合操作缓存.java

getCacheItemSetPage(long keyId, Integer pageNum, Integer pageSize) { return getCache().zrevrangeByScore(getCacheKey(keyId), Long.MAX_VALUE, 0, (pageNum - 1) * pageSize, pageSize); } /** * 获取固定区间值 * @param keyId * @param start * @param end * @return */ public static Set

getCacheItemSetRange(long keyId, int start, int end) { return getCache().zrange(getCacheKey(keyId), start, end); } /** * 获取元素分数 * @param keyId * @param itemId * @return */ public static Long getCacheItemScore(long keyId, Long itemId) { Double score = getCache().zscore(getCacheKey(keyId), String.valueOf(itemId)); if (score == null || score <= 0) { return null; } return score.longValue(); } /** * 判断元素是否存在 * @param keyId * @param itemId * @return */ public static boolean existsCacheItem(long keyId, Long itemId) { Long score = getCacheItemScore(keyId, itemId); return score==null ? false : true; } /** * 获取元素个数 * @param keyId * @return */ public static int getCacheItemCount(long keyId) { return (int) getCache().zcard(getCacheKey(keyId)); } /** * 删除缓存key * @param keyId */ public static void delCacheKey(long keyId) { getCache().del(getCacheKey(keyId)); } /** * 判断缓存key是否存在 * @param keyId * @return */ public static boolean existCacheKey(long keyId) { return getCache().exists(getCacheKey(keyId)); } //缓存 end//

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值