mirror of
https://github.com/tiennm99/zfoo.git
synced 2026-08-18 04:28:40 +00:00
Merge pull request #130 from LucaLq/main
fix[cache]: fixed a bug where expired data could not be deleted
This commit is contained in:
@@ -85,6 +85,9 @@ public class LazyCache<K, V> {
|
||||
var cacheValue = new CacheValue<V>();
|
||||
cacheValue.value = value;
|
||||
cacheValue.expireTime = TimeUtils.now() + expireAfterAccessMillis;
|
||||
if (cacheValue.expireTime < this.minExpireTime) {
|
||||
this.minExpireTime = cacheValue.expireTime;
|
||||
}
|
||||
var oldCacheValue = cacheMap.put(key, cacheValue);
|
||||
if (oldCacheValue != null) {
|
||||
removeListener.accept(List.of(new Pair<>(key, oldCacheValue.value)), RemovalCause.REPLACED);
|
||||
|
||||
Reference in New Issue
Block a user