| 限定符和类型 | 字段和说明 |
|---|---|
private CacheConfig |
config
配置
|
private AtomicInteger |
hitCount
命中计数
|
private CacheLinked<K,V> |
linked
链表
|
private AtomicInteger |
missCount
未命中计数
|
private INodeFactory<K,V> |
nodeFactory
链表节点工厂
|
| 构造器和说明 |
|---|
FifoCache(CacheConfig config,
INodeFactory<K,V> nodeFactory)
构造方法
|
| 限定符和类型 | 方法和说明 |
|---|---|
void |
clear()
清空缓存
|
V |
get(K key)
获取缓存数据
|
AtomicInteger |
getHitCount() |
AtomicInteger |
getMissCount() |
NodeAbstract<K,V> |
getNode(K key)
获取缓存节点对象
|
double |
hitRatio()
获取命中率
|
void |
put(K key,
V value)
缓存
|
void |
remove(K key)
移除缓存数据
|
int |
size()
缓存元素数量
|
private CacheLinked<K,V> linked
private INodeFactory<K,V> nodeFactory
private CacheConfig config
private AtomicInteger missCount
private AtomicInteger hitCount
public FifoCache(CacheConfig config, INodeFactory<K,V> nodeFactory)
config - 配置对象nodeFactory - 链表节点对象创建工厂public NodeAbstract<K,V> getNode(K key)
ICachepublic AtomicInteger getMissCount()
public AtomicInteger getHitCount()
Copyright © 2023. All rights reserved.