Package org.bonitasoft.engine.cache
Interface CacheService
- All Known Implementing Classes:
EhCacheCacheService
public interface CacheService
- Author:
- Baptiste Mesta
-
Method Summary
Modifier and TypeMethodDescriptionbooleanClear the cache named by cacheNamevoidclearAll()Clear all cache of the serviceGet a cached object.intgetCacheSize(String cacheName) Return the size of the cache with cacheName.Get the names of all the cachesGet list of keys on a cache.booleanbooleanRemove the element according to the cache name and the keyvoidstore(String cacheName, Serializable key, Object value) Store an object in the cache.
-
Method Details
-
store
Store 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
Remove 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
Get 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
Get 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
Clear 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
Clear all cache of the service- Throws:
SCacheException- Error thrown if has exceptions during the cache clear.
-
getCacheSize
Return 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
Get the names of all the caches- Returns:
- a list of caches names
-
isStopped
boolean isStopped()
-