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//