use long instead of Instant for time
Working with longs is faster and requires less cache. The space in L123 caches is precious.
This commit is contained in:
@@ -30,16 +30,16 @@ public class HotEntryCacheTest {
|
||||
@Test(invocationCount = 1)
|
||||
public void testRemovalListenerCalledOnExpire() throws InterruptedException {
|
||||
|
||||
final Duration originalMinSleepPeriod = HotEntryCache.getMinSleepPeriod();
|
||||
final Duration originalMaxSleepPeriod = HotEntryCache.getMaxSleepPeriod();
|
||||
final long originalMinSleepPeriod = HotEntryCache.getMinSleepPeriod();
|
||||
final long originalMaxSleepPeriod = HotEntryCache.getMaxSleepPeriod();
|
||||
try {
|
||||
final String key = "key";
|
||||
final String value = "value";
|
||||
final CountDownLatch latch = new CountDownLatch(1);
|
||||
|
||||
final HotEntryCache<String, String> cache = new HotEntryCache<>(Duration.ofMillis(1), "cache-" + ++cacheId);
|
||||
HotEntryCache.setMinSleepPeriod(Duration.ofMillis(1));
|
||||
HotEntryCache.setMaxSleepPeriod(Duration.ofMillis(10));
|
||||
HotEntryCache.setMinSleepPeriod(1);
|
||||
HotEntryCache.setMaxSleepPeriod(10);
|
||||
cache.addListener((k, v) -> {
|
||||
Assert.assertEquals(k, key);
|
||||
Assert.assertEquals(v, value);
|
||||
|
||||
Reference in New Issue
Block a user