Package org.bonitasoft.engine.cache
Interface CacheService
-
- All Known Implementing Classes:
EhCacheCacheService
public interface CacheService
- Author:
- Baptiste Mesta
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
clear(java.lang.String cacheName)
Clear the cache named by cacheNamevoid
clearAll()
Clear all cache of the servicejava.lang.Object
get(java.lang.String cacheName, java.lang.Object key)
Get a cached object.int
getCacheSize(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.boolean
isStopped()
boolean
remove(java.lang.String cacheName, java.lang.Object key)
Remove the element according to the cache name and the keyvoid
store(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 SCacheException
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
boolean remove(java.lang.String cacheName, java.lang.Object key) throws SCacheException
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
java.lang.Object get(java.lang.String cacheName, java.lang.Object key) throws SCacheException
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
java.util.List<java.lang.Object> getKeys(java.lang.String cacheName) throws SCacheException
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
boolean clear(java.lang.String cacheName) throws SCacheException
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
void clearAll() throws SCacheException
Clear all cache of the service- Throws:
SCacheException
- Error thrown if has exceptions during the cache clear.
-
getCacheSize
int getCacheSize(java.lang.String cacheName) throws SCacheException
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
java.util.List<java.lang.String> getCachesNames()
Get the names of all the caches- Returns:
- a list of caches names
-
isStopped
boolean isStopped()
-
-