public final class LRUCache<Key extends java.lang.Comparable<Key>,Value>
extends java.lang.Object
Constructor and Description |
---|
LRUCache(int sizeLimit)
Creates a cache without an expiration time.
|
LRUCache(int sizeLimit,
long expirationDelay) |
Modifier and Type | Method and Description |
---|---|
void |
clear() |
Value |
get(Key key)
Gets a value from the cache and moves it to top.
|
void |
put(Key key,
Value value)
Puts a value in the cache.
|
public LRUCache(int sizeLimit)
sizeLimit
- The maximal amount of items which the cache should hold.public LRUCache(int sizeLimit, long expirationDelay)
sizeLimit
- The maximal amount of items which the cache should hold.expirationDelay
- The amount of milliseconds after which an entry expires.public void put(Key key, Value value)
public Value get(Key key)
public void clear()