public class CachedGroup extends Object
Constructor and Description |
---|
CachedGroup(Cache<CachedQuery,CachedResult> cache)
Constructor for the CachedGroup object.
|
CachedGroup(Cache<CachedQuery,CachedResult> cache,
boolean cacheMetadata)
Constructor for the CachedGroup object.
|
CachedGroup(Cache<CachedQuery,CachedResult> cache,
int pageSize)
Constructor for the CachedGroup object.
|
CachedGroup(Cache<CachedQuery,CachedResult> cache,
int pageSize,
boolean cacheMetadata)
Constructor for the CachedGroup object.
|
Modifier and Type | Method and Description |
---|---|
boolean |
cachingMetadata()
Checks whether this cache should cache also document metadata.
|
boolean |
containsKey(CachedQuery key)
Checks whether the specified query is cached.
|
CachedResult |
get(CachedQuery key)
Gets the result associated with the specified query from the cache if the query is cached, or the result returned by the resolver.
|
Cache<CachedQuery,CachedResult> |
getCache()
Gets the actual cache used for storing query results.
|
float |
hitRatio()
Returns the hits/requests ratio in percents.
|
long |
hits()
Returns the number of all hits.
|
boolean |
isPaged()
Checks whether this cache uses paged query results.
|
long |
misses()
Returns the number of all misses.
|
int |
pageSize()
Return the capacity of query result page.
|
CachedResult |
put(CachedQuery key,
CachedResult value)
Adds a new result for the specified query to the cache.
|
CachedResult |
remove(CachedQuery key)
Removes the specified query and its result from the cache.
|
long |
requests()
Returns the number of all submitted requests
|
void |
resetCounters()
Sets hits and misses counters to zero.
|
int |
size()
Returns the number of cached query result.
|
CachedResult |
update(CachedQuery key,
CachedResult value)
Updates the result associated with the specified query in the cache if a result exists for the query.
|
public CachedGroup(Cache<CachedQuery,CachedResult> cache)
cache
- actual cache used for storing query resultspublic CachedGroup(Cache<CachedQuery,CachedResult> cache, int pageSize)
cache
- actual cache used for storing query resultspageSize
- maximum size of a pagepublic CachedGroup(Cache<CachedQuery,CachedResult> cache, boolean cacheMetadata)
cache
- actual cache used for storing query resultscacheMetadata
- whether we want do cache also documents with metadatapublic CachedGroup(Cache<CachedQuery,CachedResult> cache, int pageSize, boolean cacheMetadata)
cache
- actual cache used for storing query resultspageSize
- maximum size of a pagecacheMetadata
- whether we want do cache also documents with metadatapublic CachedResult put(CachedQuery key, CachedResult value)
key
- query to add to the cachevalue
- result to map the query topublic CachedResult get(CachedQuery key)
key
- query to get the result forpublic CachedResult remove(CachedQuery key)
key
- query to remove from the cache.public CachedResult update(CachedQuery key, CachedResult value)
key
- query to change the result forvalue
- new result associated with the keypublic boolean containsKey(CachedQuery key)
key
- query to checkpublic boolean isPaged()
public boolean cachingMetadata()
public int pageSize()
public Cache<CachedQuery,CachedResult> getCache()
public long hits()
public long misses()
public long requests()
public float hitRatio()
public void resetCounters()
public int size()
Copyright © 2016 Egothor. All Rights Reserved.