Interface GlobalCacheService

All Known Implementing Classes:
DefaultGlobalCacheService, EHCacheService, JCSCacheService

public interface GlobalCacheService
GlobalCacheService interface.
Version:
$Id$
Author:
Dave Bryson, Peter CourefreshableCachedObjectux
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    Avalon role - used to id the component within the manager
  • Method Summary

    Modifier and Type
    Method
    Description
    <T> void
    addObject(String objectId, CachedObject<T> object)
    Adds an object to the cache.
    void
    Flush the cache of all objects.
    Returns a copy of the non-expired CachedObjects in the cache as a list.
    int
    Returns the current size of the cache.
    Returns a copy of keys to objects in the cache as a list.
    int
    Returns the number of objects in the cache.
    <T> CachedObject<T>
    getObject(String objectId)
    Gets a cached object given its id (a String).
    void
    removeObject(String objectId)
    Removes an object from the cache.
  • Field Details

    • ROLE

      static final String ROLE
      Avalon role - used to id the component within the manager
  • Method Details

    • getObject

      <T> CachedObject<T> getObject(String objectId) throws ObjectExpiredException
      Gets a cached object given its id (a String).
      Type Parameters:
      T - type of object to return
      Parameters:
      objectId - The String id for the object.
      Returns:
      A CachedObject.
      Throws:
      ObjectExpiredException - if the object has expired in the cache.
    • addObject

      <T> void addObject(String objectId, CachedObject<T> object)
      Adds an object to the cache.
      Type Parameters:
      T - type of object to add
      Parameters:
      objectId - The String id for the object.
      object - The object to add to the cache.
    • removeObject

      void removeObject(String objectId)
      Removes an object from the cache.
      Parameters:
      objectId - The String id for the object.
    • getKeys

      List<String> getKeys()
      Returns a copy of keys to objects in the cache as a list. Note that keys to expired objects are not returned.
      Returns:
      A List of String's representing the keys to objects in the cache.
    • getCachedObjects

      List<CachedObject<?>> getCachedObjects()
      Returns a copy of the non-expired CachedObjects in the cache as a list.
      Returns:
      A List of CachedObject objects held in the cache
    • getCacheSize

      int getCacheSize() throws IOException
      Returns the current size of the cache.
      Returns:
      int representing current cache size in number of bytes
      Throws:
      IOException - if unable to return cache size
    • getNumberOfObjects

      int getNumberOfObjects()
      Returns the number of objects in the cache.
      Returns:
      int The current number of objects in the cache.
    • flushCache

      void flushCache()
      Flush the cache of all objects.