info.sswap.api.model
Interface Cache

All Known Implementing Classes:
ModelCache

public interface Cache

Cache for ontology terms. This cache provides temporary storage for the terms after they are retrieved, to minimize network calls (improves both efficiency as well as allows uninterrupted operation over short-term network outages). Contents of this cache have limited life time (time-to-live), which means that they are removed from the cache after this period of time, and will have to be retrieved from their original source (when they are needed; this is to allow the code to eventually notice any changes to the published terminology. The methods in this interface allow to control the cache (e.g., clear its contents, set time-to-live for each entry etc.)

Author:
Blazej Bulka

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 will be considered stale, and will have to 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 will be considered stale, and will have to 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 will be considered stale, and will have to be retrieved again from its source. (All contents in this cache share the same time-to-live value, but the decision when each term should be expired 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 will be considered stale, and will have to be retrieved again from its source. (All contents in this cache share the same time-to-live value, but the decision when each term should be expired depends on the time when that particular term was originally retrieved.)

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

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.