public class CacheMap<K,V> extends AbstractMap<K,V>
Modifier and Type | Class and Description |
---|---|
static class |
CacheMap.Builder<K,V> |
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>
Constructor and Description |
---|
CacheMap(String cacheName) |
CacheMap(String cacheName,
long timeout) |
CacheMap(String cacheName,
long timeout,
boolean refreshOnRead) |
CacheMap(String cacheName,
long timeout,
boolean refreshOnRead,
int maxSize) |
Modifier and Type | Method and Description |
---|---|
static <K,V> CacheMap.Builder<K,V> |
builder() |
static void |
clearOverflowCache(CacheMap map)
清理超过限制的缓存
|
static void |
clearTimeoutCache(CacheMap map) |
TreeSet<Map.Entry<K,V>> |
entrySet()
remove其实是通过这个来实现的,但是这里功能明显导致删除会失败,结果会内存溢出,所以我重写了remove方法
这里的entrySet实现可能是有点问题的,因为返回的是一个新的实例。
|
V |
get(Object key) |
long |
getCacheTimeout() |
Map<K,com.mxixm.fastboot.weixin.util.CacheMap.CacheEntry> |
getEntryMap() |
static void |
main(String[] args) |
V |
put(K key,
V value) |
V |
remove(Object key) |
int |
size() |
clear, clone, containsKey, containsValue, equals, hashCode, isEmpty, keySet, putAll, toString, values
finalize, getClass, notify, notifyAll, wait, wait, wait
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
public CacheMap(String cacheName, long timeout, boolean refreshOnRead, int maxSize)
public CacheMap(String cacheName, long timeout, boolean refreshOnRead)
public CacheMap(String cacheName, long timeout)
public CacheMap(String cacheName)
public static <K,V> CacheMap.Builder<K,V> builder()
public static void clearTimeoutCache(CacheMap map)
public static void clearOverflowCache(CacheMap map)
map
- public Map<K,com.mxixm.fastboot.weixin.util.CacheMap.CacheEntry> getEntryMap()
public long getCacheTimeout()
public TreeSet<Map.Entry<K,V>> entrySet()
public int size()
public static void main(String[] args)
Copyright © 2018 Guangshan Technology, Inc.. All rights reserved.