public class CacheUtil extends Object
Constructor and Description |
---|
CacheUtil() |
Modifier and Type | Method and Description |
---|---|
static <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> |
newNoCache()
创建无缓存实现.
|
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)
创建弱引用缓存.
|
public static <K,V> FIFOCache<K,V> newFIFOCache(int capacity, long timeout)
K
- Key类型V
- Value类型capacity
- 容量timeout
- 过期时长,单位:毫秒FIFOCache
public static <K,V> FIFOCache<K,V> newFIFOCache(int capacity)
K
- Key类型V
- Value类型capacity
- 容量FIFOCache
public static <K,V> LFUCache<K,V> newLFUCache(int capacity, long timeout)
K
- Key类型V
- Value类型capacity
- 容量timeout
- 过期时长,单位:毫秒LFUCache
public static <K,V> LFUCache<K,V> newLFUCache(int capacity)
K
- Key类型V
- Value类型capacity
- 容量LFUCache
public static <K,V> LRUCache<K,V> newLRUCache(int capacity, long timeout)
K
- Key类型V
- Value类型capacity
- 容量timeout
- 过期时长,单位:毫秒LRUCache
public static <K,V> LRUCache<K,V> newLRUCache(int capacity)
K
- Key类型V
- Value类型capacity
- 容量LRUCache
public static <K,V> TimedCache<K,V> newTimedCache(long timeout, long schedulePruneDelay)
K
- Key类型V
- Value类型timeout
- 过期时长,单位:毫秒schedulePruneDelay
- 间隔时长,单位毫秒TimedCache
public static <K,V> TimedCache<K,V> newTimedCache(long timeout)
K
- Key类型V
- Value类型timeout
- 过期时长,单位:毫秒TimedCache
public static <K,V> WeakCache<K,V> newWeakCache(long timeout)
K
- Key类型V
- Value类型timeout
- 过期时长,单位:毫秒WeakCache
Copyright © 2024. All rights reserved.