K
- V
- public interface Cache<K,V>
Modifier and Type | Interface and Description |
---|---|
static class |
Cache.EvictionStrategy |
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_MAX_ENTRIES
默认最大缓存个数
|
static int |
DEFAULT_TIME_TO_LIVE_SECONDS
默认存活时间
|
static Cache.EvictionStrategy |
LEAST_FREQUENTLY_USED |
static Cache.EvictionStrategy |
LEAST_RECENTLY_ADDED |
static Cache.EvictionStrategy |
LEAST_RECENTLY_USED |
Modifier and Type | Method and Description |
---|---|
void |
clear() |
V |
get(K key) |
Cache.EvictionStrategy |
getEvictionStrategy() |
long |
getHitCount() |
Map<K,V> |
getItems(int n) |
long |
getMissCount() |
String |
getName() |
V |
put(K key,
V value) |
V |
put(K key,
V value,
int liveInSeconds) |
V |
remove(K key) |
void |
setEvictionStrategy(Cache.EvictionStrategy evictionStrategy) |
void |
setMaxEntries(int maxEntries) |
void |
setTimeToLiveSeconds(int timeToLiveSeconds) |
void |
shutDown() |
void |
start(String name) |
static final int DEFAULT_TIME_TO_LIVE_SECONDS
static final int DEFAULT_MAX_ENTRIES
static final Cache.EvictionStrategy LEAST_RECENTLY_USED
static final Cache.EvictionStrategy LEAST_FREQUENTLY_USED
static final Cache.EvictionStrategy LEAST_RECENTLY_ADDED
void setEvictionStrategy(Cache.EvictionStrategy evictionStrategy)
Cache.EvictionStrategy getEvictionStrategy()
void start(String name)
void shutDown()
void setMaxEntries(int maxEntries)
void setTimeToLiveSeconds(int timeToLiveSeconds)
String getName()
long getHitCount()
long getMissCount()
void clear()
Copyright © 2016 huihoo. All rights reserved.