Interface CacheService

All Known Implementing Classes:
EhCacheCacheService

public interface CacheService
Author:
Baptiste Mesta
  • Method Details

    • store

      void store(String cacheName, Serializable key, 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 stored
      key - The key that will allow to retrieve the object
      value - The object to store
      Throws:
      SCacheException - Error thrown if has exceptions during the cache store.
    • remove

      boolean remove(String cacheName, 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

      Object get(String cacheName, Object key) throws SCacheException
      Get a cached object.
      Parameters:
      cacheName - The name of the cache on which to get the object
      key - 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

      List<Object> getKeys(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(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(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

      List<String> getCachesNames()
      Get the names of all the caches
      Returns:
      a list of caches names
    • isStopped

      boolean isStopped()