update 优化 丰富RedisUtils对List Set类型的操作

2.X
疯狂的狮子Li 1 year ago
parent 6b3ca289f8
commit cd760261bd

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

Loading…
Cancel
Save