public class TagHistoryCache
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
protected static class |
TagHistoryCache.TimeAlteredParams
Parameters with a different time range, and a return size adjusted accordingly.
|
Constructor and Description |
---|
TagHistoryCache() |
TagHistoryCache(boolean enabled,
CachePolicy policy) |
Modifier and Type | Method and 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() |
protected void |
maybeSortBuckets()
Sorts the buckets in our heap, but only every so often.
|
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) |
public TagHistoryCache()
public TagHistoryCache(boolean enabled, CachePolicy policy)
public static TagHistoryCache getInstance()
public static void reset()
public void clear()
public boolean isEnabled()
public void setEnabled(boolean value)
public CachePolicy getPolicy()
public void setPolicy(CachePolicy policy)
protected org.apache.log4j.Logger getLogger()
protected org.apache.log4j.Logger getBucketLogger()
protected double getWindowSize(TagHistoryQueryParams params)
public long getCurrentMemorySize()
protected boolean hasRoomFor(int size)
protected boolean createRoomFor(CacheBucket bucket)
public Dataset query(TagHistoryQueryProvider backingProvider, TagHistoryQueryParams queryParams) throws java.lang.Exception
java.lang.Exception
public boolean registerBucket(CacheBucket bucket)
protected void maybeSortBuckets()