public class Cache<K,V extends Cache.Value>
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static interface |
Cache.Backend<K,V>
A cache backend that can load objects from persistent storage.
|
static interface |
Cache.Value
A cacheable object.
|
Modifier and Type | Method and Description |
---|---|
void |
clear() |
V |
get(K key) |
int |
getMemoryMax() |
int |
getMemoryUsed() |
static <K,V extends Cache.Value> |
newInstance(Cache.Backend<K,V> backend,
int maxMemoryBytes) |
void |
put(K key,
V value) |
V |
replace(K key,
V value)
Get the element in the cache if one exists, or add it to the cache if not.
|
int |
size() |
public V replace(K key, V value)
key
- the keyvalue
- the valuepublic static <K,V extends Cache.Value> Cache<K,V> newInstance(Cache.Backend<K,V> backend, int maxMemoryBytes)
public void clear()
public int size()
public int getMemoryUsed()
public int getMemoryMax()
Copyright © 2010 - 2020 Adobe. All Rights Reserved