Interface GlobalCacheService

All Known Implementing Classes:
JCSCacheService

public interface GlobalCacheService
Contract for a global (application-wide) object cache.

This is the same contract as Apache Fulcrum's org.apache.fulcrum.cache.GlobalCacheService, minus the Avalon ROLE constant (Avalon's string-based component lookup has no Spring equivalent, and none is needed -- Spring resolves beans by type).

  • Method Details

    • getObject

      <T> CachedObject<T> getObject(String objectId) throws ObjectExpiredException
      Type Parameters:
      T - type of object to return
      Parameters:
      objectId - the String id for the object
      Returns:
      the cached object
      Throws:
      ObjectExpiredException - if the object has expired or is not present
    • addObject

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

      void removeObject(String objectId)
      Parameters:
      objectId - the String id for the object
    • getKeys

      List<String> getKeys()
      Returns:
      keys of the (non-expired) objects currently in the cache
    • getCachedObjects

      List<CachedObject<?>> getCachedObjects()
      Returns:
      the non-expired CachedObjects currently in the cache
    • getCacheSize

      int getCacheSize() throws IOException
      Returns:
      the current size of the cache, in bytes
      Throws:
      IOException - if unable to compute the cache size
    • getNumberOfObjects

      int getNumberOfObjects()
      Returns:
      the number of objects currently in the cache
    • flushCache

      void flushCache()
      Removes every object from the cache.