|
Jive Forums API (5.5.20.2-oracle) Developer Javadocs | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.jivesoftware.forum.database.QueryCache
public class QueryCache
Cache for storing query results. Cache contents are essentially hierarchical in nature since every cache entry is associated with a particular object (identified by object type and id). We track this information so that mass removes can be made for all entries associated with a particular object.
Nested Class Summary | |
---|---|
static interface |
QueryCache.PutGetRemoveStrategy
Defines a strategy object for different mechanisms to do the actual map access. |
Nested classes/interfaces inherited from interface java.util.Map |
---|
java.util.Map.Entry<K,V> |
Field Summary | |
---|---|
static int |
BLOCK_SIZE
Number of forumID's per cache block. |
Constructor Summary | |
---|---|
QueryCache(ClusteredCache cache)
Create a new QueryCache with specified cache as the backing cache. |
|
QueryCache(CoherenceCache cache)
Create a new QueryCache with specified cache as the backing cache. |
Method Summary | |
---|---|
void |
clear()
|
boolean |
containsKey(java.lang.Object key)
|
boolean |
containsValue(java.lang.Object value)
|
java.util.Set |
entrySet()
This method throws UnsupportedOperationException. |
java.lang.Object |
get(java.lang.Object key)
|
protected static long[] |
getBlock(CachedPreparedStatement cachedPstmt,
int objectType,
long objectID,
int startIndex,
boolean useCache)
Returns a block of objectID's (threads or messages) from a query and performs transparent caching of those blocks. |
static java.util.List |
getBlock(QueryCacheStrategy queryStrategy,
CachedPreparedStatement cachedPstmt,
int objectType,
long objectID,
int startIndex,
boolean useCache)
Returns a List of objects from a query and performs transparent caching of those blocks. |
long |
getCacheHits()
Returns the number of cache hits. |
long |
getCacheMisses()
Returns the number of cache misses. |
int |
getCacheSize()
Returns the size of the cache contents in bytes. |
protected static int |
getCount(QueryCacheKey key,
boolean useCache)
Returns the count associated with a ResultFilter query. |
int |
getMaxCacheSize()
Returns the maximum size of the cache in bytes. |
long |
getMaxLifetime()
Returns the maximum number of milliseconds that any object can live in cache. |
java.lang.String |
getName()
Returns the name of the cache. |
boolean |
isEmpty()
|
java.util.Set |
keySet()
This method throws UnsupportedOperationException. |
void |
moveToShortTerm(java.util.Collection keys)
Iterates a set of keys, moving each entry to the short term query cache. |
java.lang.Object |
put(java.lang.Object key,
java.lang.Object value)
|
void |
putAll(java.util.Map map)
This method throws UnsupportedOperationException. |
void |
remove(int objectType,
long objectID)
Removes all query keys that match the objectType and objectID combination. |
java.lang.Object |
remove(java.lang.Object key)
|
void |
removeUsers()
Removes all entries associated with users. |
void |
setMaxCacheSize(int maxSize)
Sets the maximum size of the cache in bytes. |
void |
setMaxLifetime(long maxLifetime)
Sets the maximum number of milliseconds that any object can live in cache. |
void |
setName(java.lang.String name)
Sets the name of the cache |
int |
size()
|
java.util.Collection |
values()
This method throws UnsupportedOperationException. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface java.util.Map |
---|
equals, hashCode |
Field Detail |
---|
public static final int BLOCK_SIZE
Constructor Detail |
---|
public QueryCache(CoherenceCache cache)
cache
- the backing cache.public QueryCache(ClusteredCache cache)
cache
- the backing cache.Method Detail |
---|
protected static long[] getBlock(CachedPreparedStatement cachedPstmt, int objectType, long objectID, int startIndex, boolean useCache)
cachedPstmt
- the SQL query.startIndex
- the startIndex in the list to get a block for.public static java.util.List getBlock(QueryCacheStrategy queryStrategy, CachedPreparedStatement cachedPstmt, int objectType, long objectID, int startIndex, boolean useCache)
queryStrategy
- the query strategy to use to retrieve the objectcachedPstmt
- the SQL query.objectType
- the type of the container objectobjectID
- the id of the container objectstartIndex
- the startIndex in the list to get a block for.useCache
- true to cache, false to not cache
protected static int getCount(QueryCacheKey key, boolean useCache)
key
- the key associted with the query.public void remove(int objectType, long objectID)
objectType
- the object type.objectID
- the id of the object.public void removeUsers()
public void moveToShortTerm(java.util.Collection keys)
keys
- the keys to move.public java.lang.String getName()
Cache
getName
in interface Cache
public void setName(java.lang.String name)
Cache
setName
in interface Cache
name
- the name of the cachepublic int getMaxCacheSize()
Cache
getMaxCacheSize
in interface Cache
public void setMaxCacheSize(int maxSize)
Cache
setMaxCacheSize
in interface Cache
maxSize
- the maximum size of the cache in bytes.public long getMaxLifetime()
Cache
getMaxLifetime
in interface Cache
public void setMaxLifetime(long maxLifetime)
Cache
setMaxLifetime
in interface Cache
maxLifetime
- the maximum number of milliseconds before objects are expired.public int getCacheSize()
Cache
getCacheSize
in interface Cache
public long getCacheHits()
Cache
Keeping track of cache hits and misses lets one measure how efficient the cache is; the higher the percentage of hits, the more efficient.
getCacheHits
in interface Cache
public long getCacheMisses()
Cache
Keeping track of cache hits and misses lets one measure how efficient the cache is; the higher the percentage of hits, the more efficient.
getCacheMisses
in interface Cache
public int size()
size
in interface java.util.Map
public boolean isEmpty()
isEmpty
in interface java.util.Map
public boolean containsKey(java.lang.Object key)
containsKey
in interface java.util.Map
public boolean containsValue(java.lang.Object value)
containsValue
in interface java.util.Map
public java.lang.Object get(java.lang.Object key)
get
in interface java.util.Map
public java.lang.Object put(java.lang.Object key, java.lang.Object value)
put
in interface java.util.Map
public java.lang.Object remove(java.lang.Object key)
remove
in interface java.util.Map
public void clear()
clear
in interface java.util.Map
public void putAll(java.util.Map map)
putAll
in interface java.util.Map
java.lang.UnsupportedOperationException
public java.util.Set keySet()
keySet
in interface java.util.Map
java.lang.UnsupportedOperationException
public java.util.Collection values()
values
in interface java.util.Map
java.lang.UnsupportedOperationException
public java.util.Set entrySet()
entrySet
in interface java.util.Map
java.lang.UnsupportedOperationException
|
Jive Forums Project Page | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |