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

master
疯狂的狮子Li 3 years ago
parent 9b9f424e6c
commit cd6bfb2a3a

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