public class EhCache3 extends Object implements Level1Cache, org.ehcache.event.CacheEventListener
EHCache 3.x 的缓存封装
该封装类实现了缓存操作以及对缓存数据失效的侦听
| 构造器和说明 |
|---|
EhCache3(String name,
org.ehcache.Cache<String,Object> cache,
CacheExpiredListener listener) |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
clear()
Clear the cache
|
void |
evict(String... keys)
Remove items from the cache
|
boolean |
exists(String key)
判断缓存是否存在
|
Map<String,Object> |
get(Collection<String> keys)
批量获取缓存对象
|
Object |
get(String key)
Get an item from the cache, nontransactionally
|
Collection<String> |
keys()
Return all keys
|
void |
onEvent(org.ehcache.event.CacheEvent cacheEvent) |
void |
put(Map<String,Object> elements)
批量插入数据
|
void |
put(String key,
Object value)
Add an item to the cache, nontransactionally, with
failfast semantics
|
long |
size()
返回该缓存区域中,内存存储对象的最大数量
|
long |
ttl()
返回该缓存区域的 TTL 设置(单位:秒)
|
public EhCache3(String name, org.ehcache.Cache<String,Object> cache, CacheExpiredListener listener)
public long ttl()
Level1Cachettl 在接口中 Level1Cachepublic long size()
Level1Cachesize 在接口中 Level1Cachepublic void put(String key, Object value)
Cachepublic Collection<String> keys()
Cachepublic void onEvent(org.ehcache.event.CacheEvent cacheEvent)
onEvent 在接口中 org.ehcache.event.CacheEventListenerCopyright © 2018. All rights reserved.