| Modifier and Type | Class and Description |
|---|---|
| public static interface | LruCache.
type of the cache entry Value>When the entry is not present in cache, this create action is used to create one. |
| public static interface | LruCache.
type of the cache entry Value>Action that is invoked when the entry is removed from the cache. |
| private class |
| Modifier and Type | Field and Description |
|---|---|
| private final Map | |
| private final @Nullable LruCache. | |
| private long | |
| private final ResourceLock | |
| private final long | |
| private final int | |
| private final @Nullable LruCache. |
| Access | Constructor and Description |
|---|---|
| public | |
| public | LruCache(int maxSizeEntries, long maxSizeBytes, boolean accessOrder, @Nullable LruCache.
|
| Modifier and Type | Method and Description |
|---|---|
| public Value | Returns: entry from cache or newly created entry if cache does not contain given key.cache key key)Borrows an entry from the cache. |
| private void | |
| public @Nullable Value | Returns: entry from cache or null if cache does not contain given key.cache key key)Implements org. Returns an entry from the cache. |
| public void | |
| public void |
| cache | back to summary |
|---|---|
| private final Map<Key, Value> cache | |
| createAction | back to summary |
|---|---|
| private final @Nullable LruCache. | |
| currentSize | back to summary |
|---|---|
| private long currentSize | |
| lock | back to summary |
|---|---|
| private final ResourceLock lock | |
| maxSizeBytes | back to summary |
|---|---|
| private final long maxSizeBytes | |
| maxSizeEntries | back to summary |
|---|---|
| private final int maxSizeEntries | |
| onEvict | back to summary |
|---|---|
| private final @Nullable LruCache. | |
| LruCache | back to summary |
|---|---|
| public LruCache(int maxSizeEntries, long maxSizeBytes, boolean accessOrder) | |
| LruCache | back to summary |
|---|---|
| public LruCache(int maxSizeEntries, long maxSizeBytes, boolean accessOrder, @Nullable LruCache. | |
| borrow | back to summary |
|---|---|
| public Value borrow(Key key) throws SQLException Borrows an entry from the cache.
| |
| evictValue | back to summary |
|---|---|
| private void evictValue(Value value) | |
| get | back to summary |
|---|---|
| public @Nullable Value get(Key key) Implements org. Returns an entry from the cache. | |
| put | back to summary |
|---|---|
| public void put(Key key, Value value) Returns given value to the cache.
| |
| putAll | back to summary |
|---|---|
| public void putAll(Map<Key, Value> m) Puts all the values from the given map into the cache.
| |
| Modifier and Type | Method and Description |
|---|---|
| public Value |
| create | back to summary |
|---|---|
| public Value create(Key key) throws SQLException | |
| Modifier and Type | Method and Description |
|---|---|
| public void |
| evict | back to summary |
|---|---|
| public void evict(Value value) throws SQLException | |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| protected boolean | removeEldestEntry(Map.
The least recently inserted entry in the map, or if
this is an access-ordered map, the least recently accessed
entry. This is the entry that will be removed if this
method returns eldesttrue. If the map was empty prior
to the put or putAll invocation resulting
in this invocation, this will be the entry that was just
inserted; in other words, if the map contains a single
entry, the eldest entry is also the newest.Overrides java. Returns |
| LimitedMap | back to summary |
|---|---|
| pack-priv LimitedMap(int initialCapacity, float loadFactor, boolean accessOrder) | |
| removeEldestEntry | back to summary |
|---|---|
| protected boolean removeEldestEntry(Map. Overrides java. Doc from java. Returns Sample use: this override will allow the map to grow up to 100 entries and then delete the eldest entry each time a new entry is added, maintaining a steady state of 100 entries.
private static final int MAX_ENTRIES = 100;
protected boolean removeEldestEntry(Map.Entry eldest) {
return size() > MAX_ENTRIES;
}
This method typically does not modify the map in any way,
instead allowing the map to modify itself as directed by its
return value. It is permitted for this method to modify
the map directly, but if it does so, it must return
This implementation merely returns
| |