public class CacheWrapperImpl extends java.lang.Object implements CacheWrapper
Initial Date: 03.10.2007
| 限定符和类型 | 方法和说明 |
|---|---|
java.io.Serializable |
get(java.lang.String key) |
CacheWrapper |
getOrCreateChildCacheWrapper(OLATResourceable ores)
this method is thread safe. creates a child cachewrapper that represents the cachewrapper for the given olatresourceable within this parent cachewrapper(the 'this'
object)
|
void |
put(java.lang.String key,
java.io.Serializable value)
use this put whenever you just fill up a cache from data which is already on the db or the filesystem. e.g. use it when you simply load some properties again into
cache. e.g.
|
void |
remove(java.lang.String key)
removes a value from the cache. this method is thread-safe
|
void |
update(java.lang.String key,
java.io.Serializable value)
o_clusterREVIEW :pb review references puts a value in the cache. this method is thread-safe
Use this method if you generate new data (or change existing data) that cannot be known to other nodes yet. |
void |
updateMulti(java.lang.String[] keys,
java.io.Serializable[] values)
puts several values at once into the cache. same as repeatably calling put(key, value), but more efficient. please use in favor of put if applicable.
|
public CacheWrapper getOrCreateChildCacheWrapper(OLATResourceable ores)
CacheWrappergetOrCreateChildCacheWrapper 在接口中 CacheWrapperores - the olat resourceablepublic java.io.Serializable get(java.lang.String key)
get 在接口中 CacheWrapperkey - the cache for the cache entrypublic void remove(java.lang.String key)
CacheWrapperremove 在接口中 CacheWrapperpublic void update(java.lang.String key,
java.io.Serializable value)
CacheWrapperupdate 在接口中 CacheWrapperpublic void put(java.lang.String key,
java.io.Serializable value)
CacheWrapper
CacheWrapper cw = aCache.getOrCreateChildCacheWrapper(ores);
synchronized(cw) {
String data = (String) cw.get(FULLUSERSET);
if (data == null) {
// cache entry has expired or has never been stored yet into the cache.
// or has been invalidated in cluster mode
data = loadDataFromDiskWeDidNotChangeAnythingButSimplyNeedTheDataAgain(...);
cw.putSilent(FULLUSERSET, data);
}
return data;
}
put 在接口中 CacheWrapperpublic void updateMulti(java.lang.String[] keys,
java.io.Serializable[] values)
CacheWrapperupdateMulti 在接口中 CacheWrapperkeys - the array of keysvalues - the array of values