Version: 1.1.1

org.biomoby.client
Interface SimpleFileCache

All Superinterfaces:
SimpleCache
All Known Implementing Classes:
FileCache, ServletFileCache

public interface SimpleFileCache
extends SimpleCache

An interface extending basic operations for caching data by pointing users directly to files with cached objects or for cached objects. This allows to use such files directly by other classes or even by external processes. Of course, the implementation should make sure that nobody is stepping on others toes.

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

Method Summary
 String getFilename(String id)
          Return a fully qualified path to a file that represents the cached object identified by the 'id'.
 String getURL(String id)
          Return a full URL allowing to retrieve a cached object identified by its 'id'.
 void removeOlderThen(long millis)
          Remove all cached objects that are in cache longer that specifies by 'millis'.
 void setContents(String id, byte[] data)
          Store 'data' as an object identified by 'id'.
 
Methods inherited from interface org.biomoby.client.SimpleCache
createId, existsInCache, getContents, removeFromCache, setContents
 

Method Detail

getFilename

String getFilename(String id)
                   throws IOException
Return a fully qualified path to a file that represents the cached object identified by the 'id'. Note that this file does not need to exist yet (if no object with given 'id' was stored) - but the path to the file must exist, and if not it must be created by this method.

Parameters:
id - a unique ID of the cached (or possibly cached) object
Returns:
a filename with the full path representing an object 'id'
Throws:
IOException - if creating the parent directories caused problem

setContents

void setContents(String id,
                 byte[] data)
                 throws IOException
Store 'data' as an object identified by 'id'.

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

getURL

String getURL(String id)
Return a full URL allowing to retrieve a cached object identified by its 'id'.

Parameters:
id - a unique ID

removeOlderThen

void removeOlderThen(long millis)
                     throws IOException
Remove all cached objects that are in cache longer that specifies by 'millis'.

Parameters:
millis - how many milliseconds must be an object stored to be remopved by calling this method
Throws:
IOException - if any object that exists in the cache and is targeted to be removed but cannot be removed

Version: 1.1.1

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