Class TagHistoryCache
- java.lang.Object
-
- com.inductiveautomation.ignition.common.sqltags.history.cache.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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
TagHistoryCache.TimeAlteredParams
Parameters with a different time range, and a return size adjusted accordingly.
-
Constructor Summary
Constructors Constructor Description TagHistoryCache()
TagHistoryCache(boolean enabled, CachePolicy policy)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
Clears all cached data.protected boolean
createRoomFor(CacheBucket bucket)
Used when inserting new buckets, tries to eject lower relevency buckets in order to make room.protected org.apache.log4j.Logger
getBucketLogger()
long
getCurrentMemorySize()
static TagHistoryCache
getInstance()
protected org.apache.log4j.Logger
getLogger()
CachePolicy
getPolicy()
protected double
getWindowSize(TagHistoryQueryParams params)
Returns the window size for the query, or 1/0/-1 if the query mode isn't fixed results.protected boolean
hasRoomFor(int size)
boolean
isEnabled()
Dataset
query(TagHistoryQueryProvider backingProvider, TagHistoryQueryParams queryParams)
boolean
registerBucket(CacheBucket bucket)
Inserts a bucket into the cache.static void
reset()
Clears the internal instance, causing all of the cached data to be lost.void
setEnabled(boolean value)
void
setPolicy(CachePolicy policy)
-
-
-
Constructor Detail
-
TagHistoryCache
public TagHistoryCache()
-
TagHistoryCache
public TagHistoryCache(boolean enabled, CachePolicy policy)
-
-
Method Detail
-
getInstance
public static TagHistoryCache getInstance()
-
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)
-
getPolicy
public CachePolicy getPolicy()
-
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.
-
query
public Dataset query(TagHistoryQueryProvider backingProvider, TagHistoryQueryParams queryParams) throws java.lang.Exception
- Throws:
java.lang.Exception
-
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.
-
-