Package org.bonitasoft.engine.cache
Interface CommonCacheService
-
- All Known Subinterfaces:
CacheService,PlatformCacheService
- All Known Implementing Classes:
CommonEhCacheCacheService,EhCacheCacheService,PlatformEhCacheCacheService
public interface CommonCacheService- Author:
- Baptiste Mesta
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleanclear(java.lang.String cacheName)Clear the cache named by cacheNamevoidclearAll()Clear all cache of the servicejava.lang.Objectget(java.lang.String cacheName, java.lang.Object key)Get a cached object.intgetCacheSize(java.lang.String cacheName)Return the size of the cache with cacheName.java.util.List<java.lang.String>getCachesNames()Get the names of all the cachesjava.util.List<java.lang.Object>getKeys(java.lang.String cacheName)Get list of keys on a cache.booleanisStopped()booleanremove(java.lang.String cacheName, java.lang.Object key)Remove the element according to the cache name and the keyvoidstore(java.lang.String cacheName, java.io.Serializable key, java.lang.Object value)Store an object in the cache.
-
-
-
Method Detail
-
store
void store(java.lang.String cacheName, java.io.Serializable key, java.lang.Object value) throws SCacheExceptionStore an object in the cache. If the cache don't exists it will be created.- Parameters:
cacheName- The name of the cache in which the object must be storedkey- The key that will allow to retrieve the objectvalue- The object to store- Throws:
SCacheException- Error thrown if has exceptions during the cache store.
-
remove
boolean remove(java.lang.String cacheName, java.lang.Object key) throws SCacheExceptionRemove the element according to the cache name and the key- Parameters:
cacheName-key- The name of the cache where the object must be stored The key that will allow to retrieve the object- Returns:
- true if an element was removed
- Throws:
SCacheException- Error thrown if has exceptions during the cache remove.
-
get
java.lang.Object get(java.lang.String cacheName, java.lang.Object key) throws SCacheExceptionGet a cached object.- Parameters:
cacheName- The name of the cache on which to get the objectkey- The key that is used to store the object- Returns:
- the cached object, or null if it doesn't exists
- Throws:
SCacheException- Error thrown if has exceptions during the cache object get.
-
getKeys
java.util.List<java.lang.Object> getKeys(java.lang.String cacheName) throws SCacheExceptionGet list of keys on a cache.- Parameters:
cacheName- The name of the cache on which to get the key list- Returns:
- the list of keys on the cache, or null if no keys exist
- Throws:
SCacheException
-
clear
boolean clear(java.lang.String cacheName) throws SCacheExceptionClear the cache named by cacheName- Parameters:
cacheName- The name of the cache to clear- Returns:
- Throws:
SCacheException- Error thrown if has exceptions during the cache clear.
-
clearAll
void clearAll() throws SCacheExceptionClear all cache of the service- Throws:
SCacheException- Error thrown if has exceptions during the cache clear.
-
getCacheSize
int getCacheSize(java.lang.String cacheName) throws SCacheExceptionReturn the size of the cache with cacheName.- Parameters:
cacheName- The name of cache- Returns:
- the size of the named cache
- Throws:
SCacheException- if no cache is found with that name.
-
getCachesNames
java.util.List<java.lang.String> getCachesNames()
Get the names of all the caches- Returns:
- a list of caches names
-
isStopped
boolean isStopped()
-
-