|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectuk.ac.ic.doc.automed.p2p.QueryCache
public class QueryCache
| Method Summary | |
|---|---|
void |
addListener(uk.ac.ic.doc.automed.util.cache.CacheListener cacheListener)
Register a listener for handling cache-related events |
void |
addQuery(java.lang.String query,
java.lang.Object resultObj)
Add a new query to cache. |
void |
clear()
Clear the cache |
java.util.List |
getCachedQueries()
Return all queries in the cache |
protected uk.ac.ic.doc.automed.util.cache.CacheContentDescription |
getContent()
Implements interface Cacheable. |
uk.ac.ic.doc.automed.util.cache.CacheContentDescription |
getContentObject()
Return the cache data bag |
static QueryCache |
getInstance(long ageTime)
A singleton method to make sure that there is only one instance of query cache per peer |
java.lang.Object |
getMaximalQuery(java.lang.String query)
Unlike #getQuery(query) which performs an exact query match, this method attempts to perform a maximal query rewriting against the existing views/queries in the cache and aggregate the results of the found views . |
java.lang.Object |
getQuery(java.lang.String query)
Check in the cache for an exact query match. If so return the associated result object; otherwise return null |
void |
notifyListeners(uk.ac.ic.doc.automed.util.cache.Cacheable cacheObj)
Notify listeners to handle a specific event |
void |
refresh()
refresh cache |
void |
serialise()
Save cache content to disk (or database). |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static QueryCache getInstance(long ageTime)
public void addQuery(java.lang.String query,
java.lang.Object resultObj)
query - the actual query string used for executionresultObj - the result object from query executionpublic java.lang.Object getQuery(java.lang.String query)
public java.util.List getCachedQueries()
List a list of queries in the cache OR null public java.lang.Object getMaximalQuery(java.lang.String query)
#getQuery(query) which performs an exact query match, this method
query - a new query to searchprotected uk.ac.ic.doc.automed.util.cache.CacheContentDescription getContent()
Cacheable.
Returns a List object of cache content. Each item in the list is HashMap object containing id, query, result and timestamp values
public uk.ac.ic.doc.automed.util.cache.CacheContentDescription getContentObject()
getContentObject in interface uk.ac.ic.doc.automed.util.cache.Cacheablepublic void serialise()
public void clear()
clear in interface uk.ac.ic.doc.automed.util.cache.Cacheablepublic void refresh()
refresh in interface uk.ac.ic.doc.automed.util.cache.Cacheablepublic void addListener(uk.ac.ic.doc.automed.util.cache.CacheListener cacheListener)
addListener in interface uk.ac.ic.doc.automed.util.cache.CacheablecacheListener - a CacheListener object to addpublic void notifyListeners(uk.ac.ic.doc.automed.util.cache.Cacheable cacheObj)
cacheObj - the Cacheable object to be used by listener to handle event
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||