Package org.miaixz.bus.core.xyz
Class CacheKit
java.lang.Object
org.miaixz.bus.core.xyz.CacheKit
缓存工具类
- Since:
- Java 17+
- Author:
- Kimi Liu
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <K,V> FIFOCache <K, V> newFIFOCache(int capacity) 创建FIFO(first in first out) 先进先出缓存.static <K,V> FIFOCache <K, V> newFIFOCache(int capacity, long timeout) 创建FIFO(first in first out) 先进先出缓存.static <K,V> LFUCache <K, V> newLFUCache(int capacity) 创建LFU(least frequently used) 最少使用率缓存.static <K,V> LFUCache <K, V> newLFUCache(int capacity, long timeout) 创建LFU(least frequently used) 最少使用率缓存.static <K,V> LRUCache <K, V> newLRUCache(int capacity) 创建LRU (least recently used)最近最久未使用缓存.static <K,V> LRUCache <K, V> newLRUCache(int capacity, long timeout) 创建LRU (least recently used)最近最久未使用缓存.static <K,V> NoCache <K, V> 创建无缓存实现.static <K,V> TimedCache <K, V> newTimedCache(long timeout) 创建定时缓存.static <K,V> TimedCache <K, V> newTimedCache(long timeout, long schedulePruneDelay) 创建定时缓存,通过定时任务自动清除过期缓存对象static <K,V> WeakCache <K, V> newWeakCache(long timeout) 创建弱引用缓存.
-
Constructor Details
-
CacheKit
public CacheKit()
-
-
Method Details
-
newFIFOCache
创建FIFO(first in first out) 先进先出缓存.- Type Parameters:
K- Key类型V- Value类型- Parameters:
capacity- 容量timeout- 过期时长,单位:毫秒- Returns:
FIFOCache
-
newFIFOCache
创建FIFO(first in first out) 先进先出缓存.- Type Parameters:
K- Key类型V- Value类型- Parameters:
capacity- 容量- Returns:
FIFOCache
-
newLFUCache
创建LFU(least frequently used) 最少使用率缓存.- Type Parameters:
K- Key类型V- Value类型- Parameters:
capacity- 容量timeout- 过期时长,单位:毫秒- Returns:
LFUCache
-
newLFUCache
创建LFU(least frequently used) 最少使用率缓存.- Type Parameters:
K- Key类型V- Value类型- Parameters:
capacity- 容量- Returns:
LFUCache
-
newLRUCache
创建LRU (least recently used)最近最久未使用缓存.- Type Parameters:
K- Key类型V- Value类型- Parameters:
capacity- 容量timeout- 过期时长,单位:毫秒- Returns:
LRUCache
-
newLRUCache
创建LRU (least recently used)最近最久未使用缓存.- Type Parameters:
K- Key类型V- Value类型- Parameters:
capacity- 容量- Returns:
LRUCache
-
newTimedCache
创建定时缓存,通过定时任务自动清除过期缓存对象- Type Parameters:
K- Key类型V- Value类型- Parameters:
timeout- 过期时长,单位:毫秒schedulePruneDelay- 间隔时长,单位毫秒- Returns:
TimedCache
-
newTimedCache
创建定时缓存.- Type Parameters:
K- Key类型V- Value类型- Parameters:
timeout- 过期时长,单位:毫秒- Returns:
TimedCache
-
newWeakCache
创建弱引用缓存.- Type Parameters:
K- Key类型V- Value类型- Parameters:
timeout- 过期时长,单位:毫秒- Returns:
WeakCache
-
newNoCache
创建无缓存实现.- Type Parameters:
K- Key类型V- Value类型- Returns:
NoCache
-