- All Implemented Interfaces:
CacheX<K,V>
public class GuavaCache<K,V>
extends Object
implements CacheX<K,V>
Guava 缓存支持
- Since:
- Java 17+
- Author:
- Kimi Liu
-
Constructor Summary
Constructors
-
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
GuavaCache
public GuavaCache(long size,
long expire)
-
Method Details
-
read
Description copied from interface: CacheX
从缓存中获得对象
- Specified by:
read in interface CacheX<K,V>
- Parameters:
key - 键
- Returns:
- 键对应的对象
-
read
Description copied from interface: CacheX
从缓存中获得一组对象信息
- Specified by:
read in interface CacheX<K,V>
- Parameters:
keys - 多个键
- Returns:
- 值对象
-
write
public void write(K key,
V value,
long expire)
Description copied from interface: CacheX
将对象加入到缓存,使用指定失效时长
- Specified by:
write in interface CacheX<K,V>
- Parameters:
key - 键
value - 缓存的对象
expire - 失效时长,单位毫秒
-
write
public void write(Map<K,V> keyValueMap,
long expire)
Description copied from interface: CacheX
将对象加入到缓存,使用指定失效时长
- Specified by:
write in interface CacheX<K,V>
- Parameters:
keyValueMap - 缓存的对象
expire - 失效时长,单位毫秒
- See Also:
-
-
remove
public void remove(K... keys)
Description copied from interface: CacheX
从缓存中移除对象
- Specified by:
remove in interface CacheX<K,V>
- Parameters:
keys - 键
-
clear
public void clear()
Description copied from interface: CacheX
清空缓存信息
- Specified by:
clear in interface CacheX<K,V>