Class CacheManager


  • public class CacheManager
    extends Object
    Cache Manager takes care and maintains an LRU cache which implements ManageableCache Interface. CAUTION!! If CacheManager is too much involved with the cache, other threads will be affected.
    • Constructor Detail

      • CacheManager

        public CacheManager​(ManageableCache cache,
                            int cacheMaxSize,
                            int delay)
        A new cacheManager will be started on the given ManageableCache object.
        Parameters:
        cache - a Manageable Cache which could be managed by this cache manager.
        cacheMaxSize - Maximum size of the cache. If the cache exceeds this size, LRU values will be removed
    • Method Detail

      • wakeUpNow

        public boolean wakeUpNow()
        To wake cacheManager up at will. If this method is called while its task is running, it will run its task again soon after its done. CacheManagerTask will be rescheduled as before.
        Returns:
        true if successfully waken up. false otherwise.
      • getDelay

        public int getDelay()
      • stop

        public boolean stop()
        Gracefully stop cacheManager.
      • isRunning

        public boolean isRunning()