public class EhcacheUtils extends Object
| 构造器和说明 |
|---|
EhcacheUtils() |
| 限定符和类型 | 方法和说明 |
|---|---|
static void |
clearAll()
Clears the contents of all caches in the CacheManager, but without
removing any caches.
|
static Object |
get(String cacheName,
String key)
Get object.
|
static <T extends Serializable> |
put(String cacheName,
String key,
T value)
存入
|
static <T extends Serializable> |
put(String cacheName,
String key,
T value,
boolean eternal)
存入 并设置元素是否永恒保存
|
static <T extends Serializable> |
put(String cacheName,
String key,
T value,
int timeToLiveSeconds,
int timeToIdleSeconds)
存入
|
static void |
remove(String cacheName,
String key)
Remove.
|
static void |
removeAll(String cacheName,
Collection<String> keys)
Remove all.
|
public static <T extends Serializable> void put(String cacheName, String key, T value)
T - the type parametercacheName - the cache namekey - 键value - 值public static <T extends Serializable> void put(String cacheName, String key, T value, boolean eternal)
T - the type parametercacheName - the cache namekey - 键value - 值eternal - 对象是否永久有效,一但设置了,timeout将不起作用public static <T extends Serializable> void put(String cacheName, String key, T value, int timeToLiveSeconds, int timeToIdleSeconds)
T - the type parametercacheName - the cache namekey - 键value - 值timeToLiveSeconds - 最大存活时间timeToIdleSeconds - 最大访问间隔时间public static Object get(String cacheName, String key)
cacheName - the cache namekey - the keypublic static void remove(String cacheName, String key)
cacheName - the cache namekey - the keypublic static void removeAll(String cacheName, Collection<String> keys)
cacheName - the cache namekeys - the keyspublic static void clearAll()
Ehcache.removeAll() method on each cache is called.Copyright © 2024. All rights reserved.