K - key typeV - value typepublic abstract class GenericQueryCacher<K,V> extends java.lang.Object implements CacheElement<K,V>, ReversableMultivaluesCache<K,V>, ReversableUniqueCache<K,V>
| Modifier and Type | Field and Description |
|---|---|
protected java.util.Map<V,java.util.List<K>> |
mReverse
Reverse values
|
protected java.util.Map<K,V> |
mValues
Cache container
|
| Constructor and Description |
|---|
GenericQueryCacher() |
| Modifier and Type | Method and Description |
|---|---|
V |
get(K key)
The cached entry is most probably a hash of some sort.
|
protected abstract DBFunctions |
getDB()
Get a query loaded with a query that generates the key on the first column and the value on the second one.
|
K |
getKeyForValue(V value)
Reverse query, get the key associated with a value.
|
java.util.List<K> |
getKeysForValue(V value) |
java.util.Collection<V> |
getValues()
Get the values collection
|
java.util.Collection<K> |
keySet()
Get the key set
|
protected abstract K |
readKey(DBFunctions db)
Get the key object from the current DB row
|
protected abstract V |
readValue(DBFunctions db)
Get the value object from the current DB row
|
void |
refresh()
Update the contents of the cache entry.
|
int |
size()
Get the number of values in the forward map
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetRefreshTimeprotected abstract DBFunctions getDB()
protected abstract K readKey(DBFunctions db)
db - protected abstract V readValue(DBFunctions db)
db - public final V get(K key)
CacheElementget in interface CacheElement<K,V>key - some unique keypublic final K getKeyForValue(V value)
ReversableUniqueCachegetKeyForValue in interface ReversableUniqueCache<K,V>public final java.util.List<K> getKeysForValue(V value)
getKeysForValue in interface ReversableMultivaluesCache<K,V>public java.util.Collection<K> keySet()
public java.util.Collection<V> getValues()
public int size()
public final void refresh()
CacheElementrefresh in interface CacheElement<K,V>