ca.uhn.cache.impl
Class ChunkBasedSemanticCache

java.lang.Object
  extended byca.uhn.cache.impl.ChunkBasedSemanticCache
All Implemented Interfaces:
ISemanticCache

public class ChunkBasedSemanticCache
extends java.lang.Object
implements ISemanticCache

Semantic cache implementation that uses the chunk approach described in

Version:
$Revision: 1.1 $ updated on $Date: 2005/01/24 22:52:33 $ by $Author: bryan_tripp $
Author:
Alexei Guevara

Constructor Summary
ChunkBasedSemanticCache()
           
 
Method Summary
 IQueryResult get(IQuery theQuery)
          
 IChunkStore getChunkStore()
           
 java.util.Date getEarliestCacheTime(IQuery theQuery)
          TODO: optimize!!
 IParamSpace getParamSpace()
           
 IQueryResultStore getQueryResultStore()
           
 void put(IQuery theQueryScope, IQueryResult theResult)
          
 IQuery[] remainder(IQuery theQuery, int theMaxGroups)
          Given an IQuery, find a small list of new IQuery that span all the data in the original IQuery that are not present in the cache. Some extra data may (i.e. data in the cache or data not requested) may be spaned. Generally there is a trade-off between extra data and number of new queries returned.
 void setChunkStore(IChunkStore theChunkStore)
           
 void setParamSpace(IParamSpace theParamSpace)
           
 void setQueryResultStore(IQueryResultStore theQueryResultStore)
           
 void update(IQueryResult theResult)
          Updates semantic regions that are already in the cache with revised data. This does not change the semantic scope of the cache, but may add or alter data items. If a data item moves from one semantic region to another as a result of an update, then if both regions are cached, the changed data will replace the old data, effectively removing it from the old region. If the new region is not cached, the data will remain in the old region, until it is evicted.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ChunkBasedSemanticCache

public ChunkBasedSemanticCache()
Method Detail

remainder

public IQuery[] remainder(IQuery theQuery,
                          int theMaxGroups)
                   throws CacheException
Given an IQuery, find a small list of new IQuery that span all the data in the original IQuery that are not present in the cache. Some extra data may (i.e. data in the cache or data not requested) may be spaned. Generally there is a trade-off between extra data and number of new queries returned.

Specified by:
remainder in interface ISemanticCache
Parameters:
theQuery - parameters identifying the scope of data requested
theMaxGroups - maximum number of IQuerys returned (lower numbers will generally force more extra data to be spanned). A value of 0 means that no grouping is requested.
Returns:
the smallest query emcompassing all data that are in chunks relevant to the original query and which are not in the cache.
Throws:
CacheException - If the remainder operation could not be successfully completed.

get

public IQueryResult get(IQuery theQuery)
                 throws CacheException

Specified by:
get in interface ISemanticCache
Parameters:
theQuery - parameters identifying the scope of data requested
Returns:
whatever part of requested data that is available from the cache.
Throws:
CacheException - If the get operation could not be successfully completed.

put

public void put(IQuery theQueryScope,
                IQueryResult theResult)
         throws CacheException

Specified by:
put in interface ISemanticCache
Parameters:
theQueryScope - parameters identifying the scope of a query
theResult - the results from the underlying system that are not already in the cache (to be cached)
Throws:
CacheException - If the put operation could not be successfully completed.

update

public void update(IQueryResult theResult)
            throws CacheException
Updates semantic regions that are already in the cache with revised data. This does not change the semantic scope of the cache, but may add or alter data items. If a data item moves from one semantic region to another as a result of an update, then if both regions are cached, the changed data will replace the old data, effectively removing it from the old region. If the new region is not cached, the data will remain in the old region, until it is evicted.

Specified by:
update in interface ISemanticCache
Parameters:
theResult - new or changed data items for semantic regions already in the cache
Throws:
CacheException - if operation could not be completed successfully

getParamSpace

public IParamSpace getParamSpace()
Returns:
Returns the paramSpace.

setParamSpace

public void setParamSpace(IParamSpace theParamSpace)
Parameters:
theParamSpace - The paramSpace to set.

getChunkStore

public IChunkStore getChunkStore()
Returns:
Returns the chunkStore.

setChunkStore

public void setChunkStore(IChunkStore theChunkStore)
Parameters:
theChunkStore - The chunkStore to set.

getQueryResultStore

public IQueryResultStore getQueryResultStore()
Returns:
Returns the queryResultStore.

setQueryResultStore

public void setQueryResultStore(IQueryResultStore theQueryResultStore)
Parameters:
theQueryResultStore - The queryResultStore to set.

getEarliestCacheTime

public java.util.Date getEarliestCacheTime(IQuery theQuery)
                                    throws CacheException
TODO: optimize!!

Specified by:
getEarliestCacheTime in interface ISemanticCache
Parameters:
theQuery - parameters identifying the scope of data requested
Returns:
the earlist time at which any data matching the query was cached, or null if there are no matching data
Throws:
CacheException - if operation could not be completed successfully
See Also:
ISemanticCache.getEarliestCacheTime(ca.uhn.cache.IQuery)


Copyright © 2004-2005 University Health Network. All Rights Reserved.