fix 修复 兼容redis5.0出现的问题
This commit is contained in:
parent
d403688a0c
commit
18e3b424d6
@ -107,8 +107,12 @@ public class RedisUtils {
|
|||||||
bucket.setAndKeepTTL(value);
|
bucket.setAndKeepTTL(value);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
long timeToLive = bucket.remainTimeToLive();
|
long timeToLive = bucket.remainTimeToLive();
|
||||||
|
if (timeToLive == -1) {
|
||||||
|
setCacheObject(key, value);
|
||||||
|
} else {
|
||||||
setCacheObject(key, value, Duration.ofMillis(timeToLive));
|
setCacheObject(key, value, Duration.ofMillis(timeToLive));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
bucket.set(value);
|
bucket.set(value);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user