A GeneralCacheAdministrator creates, flushes and administers the cache.
EXAMPLES :
| Method from com.opensymphony.oscache.general.GeneralCacheAdministrator Detail: |
public void cancelUpdate(String key) {
getCache().cancelUpdate(key);
}
Cancels a pending cache update. This should only be called by a thread
that received a NeedsRefreshException and was unable to generate
some new cache content. |
public void destroy() {
finalizeListeners(applicationCache);
}
Shuts down the cache administrator. |
public void flushAll() {
getCache().flushAll(new Date());
}
Flush the entire cache immediately. |
public void flushAll(Date date) {
getCache().flushAll(date);
}
Flush the entire cache at the given date. |
public void flushEntry(String key) {
getCache().flushEntry(key);
}
Flushes a single cache entry. |
public void flushGroup(String group) {
getCache().flushGroup(group);
}
Flushes all items that belong to the specified group. |
public void flushPattern(String pattern) {
getCache().flushPattern(pattern);
} Deprecated! For - performance and flexibility reasons it is preferable to
store cache entries in groups and use the #flushGroup(String) method
instead of relying on pattern flushing.
Allows to flush all items that have a specified pattern in the key. |
public Cache getCache() {
return applicationCache;
}
|
public Object getFromCache(String key) throws NeedsRefreshException {
return getCache().getFromCache(key);
}
Get an object from the cache |
public Object getFromCache(String key,
int refreshPeriod) throws NeedsRefreshException {
return getCache().getFromCache(key, refreshPeriod);
}
Get an object from the cache |
public Object getFromCache(String key,
int refreshPeriod,
String cronExpression) throws NeedsRefreshException {
return getCache().getFromCache(key, refreshPeriod, cronExpression);
}
Get an object from the cache |
public void putInCache(String key,
Object content) {
putInCache(key, content, (EntryRefreshPolicy) null);
}
|
public void putInCache(String key,
Object content,
EntryRefreshPolicy policy) {
Cache cache = getCache();
cache.putInCache(key, content, policy);
}
|
public void putInCache(String key,
Object content,
String[] groups) {
getCache().putInCache(key, content, groups);
}
Puts an object in a cache |
public void putInCache(String key,
Object content,
String[] groups,
EntryRefreshPolicy policy) {
getCache().putInCache(key, content, groups, policy, null);
}
Puts an object in a cache |
public void removeEntry(String key) {
getCache().removeEntry(key);
}
Remove an object from the cache |
public void setCacheCapacity(int capacity) {
super.setCacheCapacity(capacity);
getCache().setCapacity(capacity);
}
Sets the cache capacity (number of items). If the cache contains
more than capacity items then items will be removed
to bring the cache back down to the new size. |