| Modifier and Type | Class and Description |
|---|---|
| private static class |
| Modifier and Type | Field and Description |
|---|---|
| private Lock | |
| private Map | |
| private volatile int | |
| private int | |
| private volatile long |
| Access | Constructor and Description |
|---|---|
| public | SimpleLruCache(int
maximum size of the cache, to reduce need for synchronization
this is not a hard limit. The real size of the cache could be
slightly above this maximum if multiple threads put new values
concurrently maxSize, float when the size of the map reaches maxSize the oldest entries
will be purged to free up some space for new entries,
purgeFactor)purgeFactor is the fraction of maxSize to
purge when this happensCreate a new cache |
| Modifier and Type | Method and Description |
|---|---|
| private static void | |
| public void | configure(int
maximum size of the cache maxSize, float when the size of the map reaches maxSize the oldest entries
will be purged to free up some space for new entries,
purgeFactor)purgeFactor is the fraction of maxSize to
purge when this happensReconfigures the cache. |
| public V | |
| private void | |
| private static int | |
| public V | Returns: the previous value associated withkey, or null
if there was no mapping for keykey with which the specified value is to be associated key, V value to be associated with the specified key value)Maps the specified key to the specified value in this cache. |
| public int | |
| private long |
| lock | back to summary |
|---|---|
| private Lock lock | |
| map | back to summary |
|---|---|
| private Map<K, SimpleLruCache. | |
| maximumSize | back to summary |
|---|---|
| private volatile int maximumSize | |
| purgeSize | back to summary |
|---|---|
| private int purgeSize | |
| time | back to summary |
|---|---|
| private volatile long time | |
| SimpleLruCache | back to summary |
|---|---|
| public SimpleLruCache(int maxSize, float purgeFactor) Create a new cache
| |
| checkPurgeFactor | back to summary |
|---|---|
| private static void checkPurgeFactor(float purgeFactor) | |
| configure | back to summary |
|---|---|
| public void configure(int maxSize, float purgeFactor) Reconfigures the cache. If
| |
| get | back to summary |
|---|---|
| public V get(Object key) Returns the value to which the specified key is mapped, or
More formally, if this cache contains a mapping from a key
| |
| purge | back to summary |
|---|---|
| private void purge() | |
| purgeSize | back to summary |
|---|---|
| private static int purgeSize(int maxSize, float purgeFactor) | |
| put | back to summary |
|---|---|
| public V put(K key, V value) Maps the specified key to the specified value in this cache. Neither the key nor the value can be null.
The value can be retrieved by calling the
| |
| size | back to summary |
|---|---|
| public int size() Returns the current size of this cache
| |
| tick | back to summary |
|---|---|
private long tick()
| |
| Modifier and Type | Field and Description |
|---|---|
| private final K | |
| private volatile long | |
| private long | |
| private final V |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv void | |
| public String |
| key | back to summary |
|---|---|
| private final K key | |
| lastAccessed | back to summary |
|---|---|
| private volatile long lastAccessed | |
| lastAccessedSorting | back to summary |
|---|---|
| private long lastAccessedSorting | |
| value | back to summary |
|---|---|
| private final V value | |
| Entry | back to summary |
|---|---|
| pack-priv Entry(K key, V value, long lastAccessed) | |
| copyAccessTime | back to summary |
|---|---|
| pack-priv void copyAccessTime() | |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object.
Satisfying this method's contract implies a non-
| |