|
@@ -254,6 +254,18 @@ public class RedisUtils {
|
|
|
return rList.addAll(dataList);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 追加缓存List数据
|
|
|
+ *
|
|
|
+ * @param key 缓存的键值
|
|
|
+ * @param data 待缓存的数据
|
|
|
+ * @return 缓存的对象
|
|
|
+ */
|
|
|
+ public static <T> boolean addCacheList(final String key, final T data) {
|
|
|
+ RList<T> rList = CLIENT.getList(key);
|
|
|
+ return rList.add(data);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 注册List监听器
|
|
|
* <p>
|
|
@@ -278,6 +290,19 @@ public class RedisUtils {
|
|
|
return rList.readAll();
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 获得缓存的list对象(范围)
|
|
|
+ *
|
|
|
+ * @param key 缓存的键值
|
|
|
+ * @param form 起始下标
|
|
|
+ * @param to 截止下标
|
|
|
+ * @return 缓存键值对应的数据
|
|
|
+ */
|
|
|
+ public static <T> List<T> getCacheListRange(final String key, int form, int to) {
|
|
|
+ RList<T> rList = CLIENT.getList(key);
|
|
|
+ return rList.range(form, to);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 缓存Set
|
|
|
*
|
|
@@ -290,6 +315,18 @@ public class RedisUtils {
|
|
|
return rSet.addAll(dataSet);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 追加缓存Set数据
|
|
|
+ *
|
|
|
+ * @param key 缓存的键值
|
|
|
+ * @param data 待缓存的数据
|
|
|
+ * @return 缓存的对象
|
|
|
+ */
|
|
|
+ public static <T> boolean addCacheSet(final String key, final T data) {
|
|
|
+ RSet<T> rSet = CLIENT.getSet(key);
|
|
|
+ return rSet.add(data);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 注册Set监听器
|
|
|
* <p>
|