@Test public void testTouch() { AtomicLong clock = new AtomicLong(); LrfuEvictionQueue<BaseCacheEntry> q = new LrfuEvictionQueue<BaseCacheEntry>(clock); CacheKey key = new CacheKey(0L, 0L, 0L); BaseCacheEntry value = new BaseCacheEntry(key); q.touch(value); assertEquals(1, q.getSize()); assertNotNull(q.firstEntry(true)); clock.set(LrfuEvictionQueue.MIN_INTERVAL); q.touch(value); assertEquals(1, q.getSize()); assertNotNull(q.firstEntry(true)); }
public void touch(V value) { long tick = clock.get(); if (tick - MIN_INTERVAL < value.getKey().getLastAccess()) { add(value); return; } remove(value); recordAccess(value); add(value); }
LrfuEvictionQueue { public void touch(V value) { long tick = clock.get(); if (tick - MIN_INTERVAL < value.getKey().getLastAccess()) { add(value); return; } remove(value); recordAccess(value); add(value); } }
LrfuEvictionQueue { public void touch(V value) { long tick = clock.get(); if (tick - MIN_INTERVAL < value.getKey().getLastAccess()) { add(value); return; } remove(value); recordAccess(value); add(value); } LrfuEvictionQueue(AtomicLong clock); }
LrfuEvictionQueue { public void touch(V value) { long tick = clock.get(); if (tick - MIN_INTERVAL < value.getKey().getLastAccess()) { add(value); return; } remove(value); recordAccess(value); add(value); } LrfuEvictionQueue(AtomicLong clock); boolean remove(V value); boolean add(V value); void touch(V value); Collection<V> getEvictionQueue(); V firstEntry(boolean poll); void setHalfLife(long halfLife); int getSize(); @Override String toString(); }
LrfuEvictionQueue { public void touch(V value) { long tick = clock.get(); if (tick - MIN_INTERVAL < value.getKey().getLastAccess()) { add(value); return; } remove(value); recordAccess(value); add(value); } LrfuEvictionQueue(AtomicLong clock); boolean remove(V value); boolean add(V value); void touch(V value); Collection<V> getEvictionQueue(); V firstEntry(boolean poll); void setHalfLife(long halfLife); int getSize(); @Override String toString();  }