info.sswap.api.model
Interface Cache


public interface Cache

Cache for ontology terms. This cache provides temporary storage for terms after they are retrieved. It acts to minimize network calls (both improving efficiency as well as allowing uninterrupted operation over short-term network outages). Contents of the cache have limited life time (time-to-live), which means that they are removed from the cache after a period of time, and will be retrieved from their original source (when they are needed; this is to allow the system to update to potential changes to the published terminologies).

The cache can be primed by simply reading a term (e.g., with SSWAP.createSSWAPDocument(java.net.URI), for example, during servlet initialization. Upon reading, full closure of terms referenced therein will be also be cached. But terms will be purged after the time-to-live (TTL), so to keep terms persistent in the cache, said terms will need to be re-read at an interval less than the cache TTL.

The methods in this interface allow basic of control the cache (e.g., clear its contents, set time-to-live, etc.). Low level control of certain parameters may be set with Config.

Author:
Blazej Bulka
See Also:
Config, SSWAP

Method Summary
 void clear()
          Removes all entries from the cache.
 java.io.File getDirectory()
          Gets the directory where the cache contents are stored.
 long getTimeToLive()
          Gets the current time-to-live for entries in this cache; that is, the time after which an entry in this cache is considered stale, and will be retrieved again from its source.
 void setTimeToLive(long timeToLive)
          Sets the time-to-live for entries in this cache; that is, the time after which an entry in this cache is considered stale, and will be retrieved again from its source.
 

Method Detail

clear

void clear()
Removes all entries from the cache.


getTimeToLive

long getTimeToLive()
Gets the current time-to-live for entries in this cache; that is, the time after which an entry in this cache is considered stale, and will be retrieved again from its source. (All contents in this cache share the same time-to-live value, but the decision when each term expires depends on the time when that particular term was originally retrieved.)

Returns:
the time-to-live for a cache entry in milliseconds

setTimeToLive

void setTimeToLive(long timeToLive)
Sets the time-to-live for entries in this cache; that is, the time after which an entry in this cache is considered stale, and will be retrieved again from its source. (All contents in this cache share the same time-to-live value, but the decision when each term expires depends on the time when that particular term was originally retrieved.)

Parameters:
timeToLive - time-to-live for a cache entry in milliseconds (0 disables the cache; a negative value resets the time-to-live to the default value, as defined in Config).

getDirectory

java.io.File getDirectory()
Gets the directory where the cache contents are stored.

Returns:
Java File object representing the directory where the cache contents are stored.


Copyright (c) 2011, iPlant Collaborative, University of Arizona, Cold Spring Harbor Laboratories, University of Texas at Austin.