Version: 1.1.1

org.biomoby.client
Interface SimpleCache

All Known Subinterfaces:
SimpleFileCache
All Known Implementing Classes:
CentralCachedCallsImpl, CentralDigestCachedImpl, CentralDigestCachedSimpleImpl, CentralDigestImpl, CentralImpl, FileCache, ServletFileCache

public interface SimpleCache

An interface defining basic operation for caching data.

Version:
$Id: SimpleCache.java,v 1.4 2005/05/19 15:57:25 senger Exp $
Author:
Martin Senger

Method Summary
 String createId(String rootName, String semanticType, String syntaxType, long lastModified, Properties props)
          Create a unique ID from the given parameters.
 boolean existsInCache(String id)
          Is the object identified by its 'id' already cached?
 Object getContents(String id)
          Return 'data' identified by 'id'.
 void removeFromCache(String id)
          Remove cached object identified by its 'id' from the cache.
 void setContents(String id, Object data)
          Store/cache 'data' identified by 'id'.
 

Method Detail

createId

String createId(String rootName,
                String semanticType,
                String syntaxType,
                long lastModified,
                Properties props)
Create a unique ID from the given parameters. The ID is used to identify a cached object. Depending on the implementation it can be a filename, a database primary key, or something else. Its important characteristic, however, is that given the same set of properties describing the cached object, the same ID is always created.

Parameters:
rootName - is some high level name of the cached object
semanticType - is yet another feature of the cached object
syntaxType - is another property of the cached object (e.i. it may be used as the file name suffix if the cache is implemented as a filesystem)
lastModified - is time in millis indicating when the cached object was created or modified
props - are all remaining properties identifying the cached object
Returns:
a unique ID that can be used in other methods defined in this interface in order to identify the same cached object

existsInCache

boolean existsInCache(String id)
Is the object identified by its 'id' already cached?

Parameters:
id - a unique ID of the cached (or possibly cached) object
Returns:
true if the object identified by 'id' already exists in this cache

getContents

Object getContents(String id)
                   throws IOException
Return 'data' identified by 'id'.

Parameters:
id - a unique ID of the object being returned
Returns:
data previously stored under 'id'; or null if such data do not exist
Throws:
IOExcepiton - if the retrieving failed
IOException

setContents

void setContents(String id,
                 Object data)
                 throws IOException
Store/cache 'data' identified by 'id'.

Parameters:
id - a unique ID of the object being stored
data - are being stored
Throws:
IOExcepiton - if the storing failed
IOException

removeFromCache

void removeFromCache(String id)
                     throws IOException
Remove cached object identified by its 'id' from the cache.

Parameters:
id - a unique ID
Throws:
IOException - if the object exists but cannot be removed (meaning that it does not raise any exception if the object is not anymore in the cache)

Version: 1.1.1

Submit a bug or feature
Generated: Sat May 29 04:26:35 EDT 2010