mirror of
https://github.com/proxiodev/RedisBungee.git
synced 2024-12-23 10:38:01 +00:00
Make sure we don't spuriously empty caches.
This commit is contained in:
parent
7ee37ae4cb
commit
020341590f
@ -64,7 +64,7 @@ public class InternalCache<K, V> {
|
||||
long fixedReference = System.currentTimeMillis();
|
||||
for (Iterator<Map.Entry<K, Holder>> it = map.entrySet().iterator(); it.hasNext(); ) {
|
||||
Map.Entry<K, Holder> entry = it.next();
|
||||
if (entry.getValue().expiry > fixedReference)
|
||||
if (entry.getValue().expiry <= fixedReference)
|
||||
it.remove();
|
||||
}
|
||||
}
|
||||
|
@ -97,7 +97,19 @@ public class InternalCacheTest {
|
||||
}
|
||||
}));
|
||||
try {
|
||||
Thread.sleep(20);
|
||||
Thread.sleep(5);
|
||||
} catch (InterruptedException e) {
|
||||
throw new AssertionError(e);
|
||||
}
|
||||
cache.cleanup();
|
||||
Assert.assertEquals(one, cache.get("hi", new Callable<Object>() {
|
||||
@Override
|
||||
public Object call() throws Exception {
|
||||
return two;
|
||||
}
|
||||
}));
|
||||
try {
|
||||
Thread.sleep(5);
|
||||
} catch (InterruptedException e) {
|
||||
throw new AssertionError(e);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user