Search in sources :

Example 1 with BaseCacheEntry

use of org.teiid.common.buffer.BaseCacheEntry in project teiid by teiid.

the class TestLrfuEvictionQueue method testTouch.

@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));
    // advance the clock to perform the remove/add
    clock.set(LrfuEvictionQueue.MIN_INTERVAL);
    q.touch(value);
    assertEquals(1, q.getSize());
    assertNotNull(q.firstEntry(true));
}
Also used : AtomicLong(java.util.concurrent.atomic.AtomicLong) BaseCacheEntry(org.teiid.common.buffer.BaseCacheEntry) CacheKey(org.teiid.common.buffer.CacheKey) Test(org.junit.Test)

Aggregations

AtomicLong (java.util.concurrent.atomic.AtomicLong)1 Test (org.junit.Test)1 BaseCacheEntry (org.teiid.common.buffer.BaseCacheEntry)1 CacheKey (org.teiid.common.buffer.CacheKey)1