public class FIFOCache<K,V> extends AbstractCacheMap<K,V>
FIFO (first in first out): just adds items to the cache as they are accessed, putting them in a queue or buffer and not changing their location in the buffer; when the cache is full, items are ejected in the order they were added. Cache access overhead is constant time regardless of the size of the cache. The advantage of this algorithm is that it's simple and fast; it can be implemented using a simple array and an index. The disadvantage is that it's not very smart; it doesn't make any effort to keep more commonly used items in cache.
Summary for FIFO: fast, not adaptive, not scan resistant.
cacheMap, cacheSize, existCustomTimeout, hitCount, missCount, timeout
Constructor and Description |
---|
FIFOCache(int cacheSize) |
FIFOCache(int cacheSize,
long timeout)
Creates a new LRU cache.
|
Modifier and Type | Method and Description |
---|---|
protected int |
pruneCache()
Prune expired objects and, if cache is still full, the first one.
|
clear, createCacheObject, get, getHitCount, getMissCount, isEmpty, isFull, isPruneExpiredActive, isReallyFull, limit, onRemove, prune, put, put, remove, size, snapshot, timeout
public FIFOCache(int cacheSize)
public FIFOCache(int cacheSize, long timeout)
protected int pruneCache()
pruneCache
in class AbstractCacheMap<K,V>
Copyright © 2003-present Jodd Team