add 新增 RedisUtils.setObjectIfAbsent 如果不存在则设置 方法

2.X
疯狂的狮子Li 2 years ago
parent 9af2038efa
commit 69cb17f0f1

@ -129,6 +129,18 @@ public class RedisUtils {
batch.execute();
}
/**
* true false
*
* @param key
* @param value
* @return set
*/
public static <T> boolean setObjectIfAbsent(final String key, final T value, final Duration duration) {
RBucket<T> bucket = CLIENT.getBucket(key);
return bucket.setIfAbsent(value, duration);
}
/**
*
* <p>

Loading…
Cancel
Save