public interface Level2Cache extends Cache
Modifier and Type | Field and Description |
---|---|
static org.slf4j.Logger |
log |
Modifier and Type | Method and Description |
---|---|
void |
clear()
Clear the cache
|
void |
evict(String... keys)
Remove items from the cache
|
default boolean |
exists(String key)
判断缓存数据是否存在
|
default Map<String,Object> |
get(Collection<String> keys)
批量获取缓存对象
|
default Object |
get(String key)
Get an item from the cache, nontransactionally
|
List<byte[]> |
getBytes(Collection<String> keys)
同时读取多个 Key
|
byte[] |
getBytes(String key)
读取缓存数据字节数组
|
Collection<String> |
keys()
Return all keys
|
default void |
put(Map<String,Object> elements)
批量插入数据
|
default void |
put(Map<String,Object> elements,
long timeToLiveInSeconds) |
default void |
put(String key,
Object value)
Add an item to the cache, nontransactionally, with
failfast semantics
|
default void |
put(String key,
Object value,
long timeToLiveInSeconds)
设置缓存数据的有效期
|
void |
setBytes(Map<String,byte[]> bytes)
同时设置多个数据
|
default void |
setBytes(Map<String,byte[]> bytes,
long timeToLiveInSeconds)
批量设置带 TTL 的缓存数据
|
void |
setBytes(String key,
byte[] bytes)
设置缓存数据字节数组
|
default void |
setBytes(String key,
byte[] bytes,
long timeToLiveInSeconds)
设置缓存数据字节数组(带有效期)
|
default boolean |
supportTTL()
是否支持缓存 TTL 的设置
|
default boolean supportTTL()
byte[] getBytes(String key)
key
- cache keyList<byte[]> getBytes(Collection<String> keys)
keys
- multiple cache keyvoid setBytes(String key, byte[] bytes)
key
- cache keybytes
- cache datadefault void setBytes(String key, byte[] bytes, long timeToLiveInSeconds)
key
- cache keybytes
- cache datatimeToLiveInSeconds
- cache ttldefault void setBytes(Map<String,byte[]> bytes, long timeToLiveInSeconds)
bytes
- cache datatimeToLiveInSeconds
- cache ttldefault boolean exists(String key)
Collection<String> keys()
void evict(String... keys)
default Object get(String key)
Cache
default Map<String,Object> get(Collection<String> keys)
Cache
default void put(String key, Object value)
Cache
default void put(String key, Object value, long timeToLiveInSeconds)
key
- cache keyvalue
- cache valuetimeToLiveInSeconds
- cache ttlCopyright © 2018. All rights reserved.