add 增加 RedisUtils set 保留 TTL 有效期方法

feature/model
疯狂的狮子li 3 years ago
parent 65a1245a03
commit d0c4b5bc76

@ -88,7 +88,24 @@ public class RedisUtils {
* @param value
*/
public static <T> void setCacheObject(final String key, final T value) {
client.getBucket(key).set(value);
setCacheObject(key, value, false);
}
/**
* TTL
*
* @param key
* @param value
* @param isSaveTtl TTL(: setttl90 set90)
* @since Redis 6.0.0
*/
public static <T> void setCacheObject(final String key, final T value, final boolean isSaveTtl) {
RBucket<Object> bucket = client.getBucket(key);
if (isSaveTtl) {
bucket.setAndKeepTTL(value);
} else {
bucket.set(value);
}
}
/**

Loading…
Cancel
Save