public abstract class LimitedCacheBase extends Object implements Cache
Modifier and Type | Class and Description |
---|---|
static class |
LimitedCacheBase.TimedThing<T> |
Cache.Clock, Cache.Controller, Cache.Registry
Modifier and Type | Field and Description |
---|---|
protected Cache.Clock |
clock |
protected int |
identity |
protected String |
label |
Constructor and Description |
---|
LimitedCacheBase(Cache.Clock clock,
String label) |
Modifier and Type | Method and Description |
---|---|
void |
cacheDescription(List<com.hp.hpl.jena.rdf.model.Resource> results,
String view,
APIResultSet rs,
long expiresAt)
Make an entry in the caches that associates the result set
rs
with the given list of resources and view. |
void |
cacheSelection(String select,
List<com.hp.hpl.jena.rdf.model.Resource> results,
long expiresAt)
Make an entry in the cache that binds the given list of results
to the given select query string.
|
void |
clear()
Clear this cache.
|
protected abstract boolean |
exceedsCountLimit(com.epimorphics.lda.cache.LimitedCacheBase.Cachelet<String,LimitedCacheBase.TimedThing<Integer>> cr) |
protected abstract boolean |
exceedsResponseLimit(com.epimorphics.lda.cache.LimitedCacheBase.Cachelet<URI,LimitedCacheBase.TimedThing<ResponseResult>> cr) |
protected abstract boolean |
exceedsResultSetLimit(com.epimorphics.lda.cache.LimitedCacheBase.Cachelet<String,LimitedCacheBase.TimedThing<APIResultSet>> m) |
protected abstract boolean |
exceedsSelectLimit(com.epimorphics.lda.cache.LimitedCacheBase.Cachelet<String,LimitedCacheBase.TimedThing<List<com.hp.hpl.jena.rdf.model.Resource>>> m) |
LimitedCacheBase.TimedThing<ResponseResult> |
fetch(URI uri) |
List<com.hp.hpl.jena.rdf.model.Resource> |
getCachedResources(String select)
Answer the list of resources associated with this select query if
any is available (entered and not discarded).
|
LimitedCacheBase.TimedThing<APIResultSet> |
getCachedResultSet(List<com.hp.hpl.jena.rdf.model.Resource> results,
String view)
Answer the API result set remembered for the given list of results and
view, or null if there isn't one.
|
int |
getCount(String countQueryString)
Get the total number of items that this query will return, -1 for
"not known".
|
int |
numEntries()
Answer how many entries are in this cache.
|
void |
putCount(String countQueryString,
int count,
long expiresAt)
Put the total number of items that this query returns.
|
void |
resetCounts()
Reset to suitable zeroes the counts of this cache.
|
void |
show(StringBuilder sb)
Append an HTML description of this cache to
sb . |
void |
store(URI uri,
ResponseResult toStore,
long expiresAt) |
String |
summary()
Answer a summary description of this cache.
|
protected final String label
protected final int identity
protected final Cache.Clock clock
public LimitedCacheBase(Cache.Clock clock, String label)
public String summary()
Cache
public void show(StringBuilder sb)
Cache
sb
.public LimitedCacheBase.TimedThing<ResponseResult> fetch(URI uri)
public void store(URI uri, ResponseResult toStore, long expiresAt)
protected abstract boolean exceedsResponseLimit(com.epimorphics.lda.cache.LimitedCacheBase.Cachelet<URI,LimitedCacheBase.TimedThing<ResponseResult>> cr)
protected abstract boolean exceedsCountLimit(com.epimorphics.lda.cache.LimitedCacheBase.Cachelet<String,LimitedCacheBase.TimedThing<Integer>> cr)
protected abstract boolean exceedsSelectLimit(com.epimorphics.lda.cache.LimitedCacheBase.Cachelet<String,LimitedCacheBase.TimedThing<List<com.hp.hpl.jena.rdf.model.Resource>>> m)
protected abstract boolean exceedsResultSetLimit(com.epimorphics.lda.cache.LimitedCacheBase.Cachelet<String,LimitedCacheBase.TimedThing<APIResultSet>> m)
public LimitedCacheBase.TimedThing<APIResultSet> getCachedResultSet(List<com.hp.hpl.jena.rdf.model.Resource> results, String view)
Cache
getCachedResultSet
in interface Cache
public List<com.hp.hpl.jena.rdf.model.Resource> getCachedResources(String select)
Cache
getCachedResources
in interface Cache
public void cacheDescription(List<com.hp.hpl.jena.rdf.model.Resource> results, String view, APIResultSet rs, long expiresAt)
Cache
rs
with the given list of resources and view.cacheDescription
in interface Cache
public void cacheSelection(String select, List<com.hp.hpl.jena.rdf.model.Resource> results, long expiresAt)
Cache
cacheSelection
in interface Cache
public int getCount(String countQueryString)
public void putCount(String countQueryString, int count, long expiresAt)
public void resetCounts()
Cache
resetCounts
in interface Cache
public void clear()
Cache
public int numEntries()
Cache
numEntries
in interface Cache
Copyright © 2014. All Rights Reserved.