class TimedMap extends Object
Modifier and Type | Class and Description |
---|---|
private class |
TimedMap.Evictor
Expired mapping eviction thread.
|
private static class |
TimedMap.Mapping
Key/value mapping.
|
private static class |
TimedMap.Queue
Lightweight doubly-linked queue supporting constant-time manipulation.
|
Modifier and Type | Field and Description |
---|---|
private boolean |
evictorActive |
private TimedMap.Queue |
evictQueue |
private Executor |
executor |
private Map |
map |
private long |
timeout |
Constructor and Description |
---|
TimedMap(Executor executor,
long timeout)
Creates empty TimedMap which uses threads from the given Executor to
evict entries after the specified timeout.
|
Modifier and Type | Method and Description |
---|---|
(package private) void |
evicted(Object key,
Object value)
Upcall invoked after key's timeout has expired and key has been removed
from the map.
|
(package private) Object |
get(Object key)
Returns value associated with given key, or null if no mapping for key
is found.
|
(package private) Object |
put(Object key,
Object value)
Associates the given key with the given value, resetting the key's
timeout.
|
(package private) Object |
remove(Object key)
Removes mapping for key from map, returning the value associated with
the key (or null if no mapping present).
|
private final Executor executor
private final long timeout
private final Map map
private final TimedMap.Queue evictQueue
private boolean evictorActive
TimedMap(Executor executor, long timeout)
Object put(Object key, Object value)
Object get(Object key)
Object remove(Object key)
Copyright 2007-2013, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.