Protege 3.3.1

edu.stanford.smi.protege.util.transaction
Interface Cache<V,R>

Type Parameters:
V - the variable type
R - the result set type
All Known Subinterfaces:
LosslessCache<V,R>
All Known Implementing Classes:
CacheImpl, LosslessCacheImpl

public interface Cache<V,R>

This interface represents a simple cache mechanism for storing cached values either globally or on a per session basis. This cache mechanism is caching the values (of type R) of a variable (of type V). The global cache is to be interpreted as the latest data from the database. The session cache is a cache of data as found in the a transactionn for a session.

Author:
tredmond

Method Summary
 boolean isCached(V var)
          determines if the variable var is cached in the global cache.
 R readCache(V var)
          If the variable var is cached then this returns the cached value.
 void removeCacheEntry(V var)
          Invalidates the global cache for the variable var.
 void writeCache(V var, R result)
          Writes the value result to the global cache for the variable var.
 

Method Detail

isCached

boolean isCached(V var)
determines if the variable var is cached in the global cache. isCached(var) should always be checked before calling read(var).

Parameters:
var - a variable
Returns:
whether the variable is cached.

readCache

R readCache(V var)
If the variable var is cached then this returns the cached value. It can be null.

Parameters:
var - a variable
Returns:
the value in the cache for the variable var.

writeCache

void writeCache(V var,
                R result)
Writes the value result to the global cache for the variable var.

Parameters:
var - a variable
result - the cached value for the variable.

removeCacheEntry

void removeCacheEntry(V var)
Invalidates the global cache for the variable var.

Parameters:
var - a variable

Protege 3.3.1

Submit a bug report or feature request
Protégé is a trademark of Stanford University.
Copyright (c) 1998-2007 Stanford University.