Class TagHistoryCache


  • public class TagHistoryCache
    extends java.lang.Object
    A cache system for SQLTags History data. It is currently available as a singleton, but for 3rd party use should be instantiated.
    • Constructor Detail

      • TagHistoryCache

        public TagHistoryCache()
      • TagHistoryCache

        public TagHistoryCache​(boolean enabled,
                               CachePolicy policy)
    • Method Detail

      • reset

        public static void reset()
        Clears the internal instance, causing all of the cached data to be lost.
      • clear

        public void clear()
        Clears all cached data.
      • isEnabled

        public boolean isEnabled()
      • setEnabled

        public void setEnabled​(boolean value)
      • setPolicy

        public void setPolicy​(CachePolicy policy)
      • getLogger

        protected org.apache.log4j.Logger getLogger()
      • getBucketLogger

        protected org.apache.log4j.Logger getBucketLogger()
      • getWindowSize

        protected double getWindowSize​(TagHistoryQueryParams params)
        Returns the window size for the query, or 1/0/-1 if the query mode isn't fixed results.
      • getCurrentMemorySize

        public long getCurrentMemorySize()
      • hasRoomFor

        protected boolean hasRoomFor​(int size)
      • createRoomFor

        protected boolean createRoomFor​(CacheBucket bucket)
        Used when inserting new buckets, tries to eject lower relevency buckets in order to make room. If there is already enough room, doesn't eject anything.
      • registerBucket

        public boolean registerBucket​(CacheBucket bucket)
        Inserts a bucket into the cache.
        Returns:
        false if there isn't enough room for the bucket's data. This means the bucket should discard its data and be provisional.