public abstract class AbstractAOCache<T extends LongEntity> extends Object
Please only use for the most repeated queries.
Note that, for best efficiency: - this cache requires that fetch() be called in the same order as 'list', - this cache requires that all entities be in the same space (and be uniquely identified by their key).
Modifier and Type | Field and Description |
---|---|
protected com.atlassian.activeobjects.external.ActiveObjects |
ao |
protected Map<String,List<T>> |
cache |
protected int |
CACHE_SIZE |
protected Class<T> |
entityClass |
protected String |
field |
protected int |
indexEnd |
protected int |
indexStart |
protected List<String> |
list |
private org.apache.log4j.Logger |
log |
Constructor and Description |
---|
AbstractAOCache(com.atlassian.activeobjects.external.ActiveObjects ao,
String field,
List<String> list,
Class<T> entityClass) |
Modifier and Type | Method and Description |
---|---|
void |
addToCache(AOPreloader<T> preloader)
Add all the values in the preloader, to our current cache
|
void |
addToCache(T item) |
protected abstract void |
appendQuerySuffix(StringBuilder query,
List<Object> arguments) |
protected List<T> |
fetchCached(String requestedKey) |
private int |
findNextIndex(String requestedKey) |
protected abstract String |
getKey(T item)
Return the 'key' of 'item', or null if the element shouldn't be in the cache
|
String |
toString() |
private final org.apache.log4j.Logger log
protected final com.atlassian.activeobjects.external.ActiveObjects ao
protected int indexStart
protected int indexEnd
protected Map<String,List<T extends LongEntity>> cache
protected final int CACHE_SIZE
protected final String field
protected final Class<T extends LongEntity> entityClass
protected abstract void appendQuerySuffix(StringBuilder query, List<Object> arguments)
protected abstract String getKey(T item)
public void addToCache(T item)
public void addToCache(AOPreloader<T> preloader)
private int findNextIndex(String requestedKey)
Copyright © 2022 Requirement Yogi. All rights reserved.