Interface Cache

  • All Known Implementing Classes:
    AbstractCache, ConcurrentCache

    public interface Cache
    A Cache object A cache must call CacheManager.getInstance().add(this) to take part in the dynamic memory distribution.
    • Method Detail

      • setMaxMemorySize

        void setMaxMemorySize​(long size)
        Set the new memory limit.
        size - the size in bytes
      • getMaxMemorySize

        long getMaxMemorySize()
        Get the current limit.
        the size in bytes
      • getMemoryUsed

        long getMemoryUsed()
        Get the amount of used memory.
        the size in bytes
      • getAccessCount

        long getAccessCount()
        Get the number of accesses (get or set) until resetAccessCount was called.
        the count
      • resetAccessCount

        void resetAccessCount()
        Reset the access counter.
      • getTotalAccessCount

        long getTotalAccessCount()
        Get the total number of cache accesses.
        the number of hits
      • getMissCount

        long getMissCount()
        Get the number of cache misses.
        the number of misses
      • resetMissCount

        void resetMissCount()
        Reset the cache miss counter.
      • getElementCount

        long getElementCount()
        Get the number of elements/objects in the cache.
        the number of elements
      • setAccessListener

        void setAccessListener​(CacheAccessListener listener)
        Add a listener to this cache that is informed after a number of accesses.
      • getCacheInfoAsString

        String getCacheInfoAsString()
        Gathers the stats of the cache for logging.