| Package | Description |
|---|---|
| org.tio.utils.cache |
| Modifier and Type | Class and Description |
|---|---|
class |
AbstractCache<K extends Serializable,V extends Serializable>
超时和限制大小的缓存的默认实现
继承此抽象缓存需要: 创建一个新的Map 实现 prune 策略
|
class |
FIFOCache<K extends Serializable,V extends Serializable>
FIFO(first in first out) 先进先出缓存.
|
class |
LFUCache<K extends Serializable,V extends Serializable>
LFU(least frequently used) 最少使用率缓存
根据使用次数来判定对象是否被持续缓存 使用率是通过访问次数计算的。 |
class |
LRUCache<K extends Serializable,V extends Serializable>
LRU (least recently used)最近最久未使用缓存
根据使用时间来判定对象是否被持续缓存 当对象被访问时放入缓存,当缓存满了,最久未被使用的对象将被移除。 |
class |
ReentrantCache<K extends Serializable,V extends Serializable>
使用
ReentrantLock保护的缓存,读写都使用悲观锁完成,主要避免某些Map无法使用读写锁的问题例如使用了LinkedHashMap的缓存,由于get方法也会改变Map的结构,因此读写必须加互斥锁 |
class |
TimedCache<K extends Serializable,V extends Serializable>
定时缓存
此缓存没有容量限制,对象只有在过期后才会被移除 |
| Modifier and Type | Method and Description |
|---|---|
Cache<K,V> |
Cache.setListener(CacheListener<K,V> listener)
设置监听
|
Copyright © 2025. All rights reserved.