com.nutiteq.cache
Interface Cache

All Known Implementing Classes:
CachingChain, MemoryCache, RmsCache

public interface Cache

Interface for library caching implementation. At the moment three caching levels are supported:

Caching definition needs to be revised in the future.


Field Summary
static int CACHE_LEVEL_MEMORY
          Cache items at memory level
static int CACHE_LEVEL_NONE
          Don't cache items
static int CACHE_LEVEL_PERSISTENT
          Cache item to persistent storage.
 
Method Summary
 void cache(java.lang.String cacheKey, byte[] data, int cacheLevel)
          Cache given data
 boolean contains(java.lang.String cacheKey)
          Does this cache contain data for given cache key
 boolean contains(java.lang.String cacheKey, int cacheLevel)
          Does the specified cache level contain given cache key
 void deinitialize()
          Clean up cache resources and, if needed, write cache definition/index somewhere.
 byte[] get(java.lang.String cacheKey)
          Get cached data.
 void initialize()
          Initialize needed resources for cache.
 

Field Detail

CACHE_LEVEL_NONE

static final int CACHE_LEVEL_NONE
Don't cache items

See Also:
Constant Field Values

CACHE_LEVEL_MEMORY

static final int CACHE_LEVEL_MEMORY
Cache items at memory level

See Also:
Constant Field Values

CACHE_LEVEL_PERSISTENT

static final int CACHE_LEVEL_PERSISTENT
Cache item to persistent storage. Based on implementation can be RMS or file system.

See Also:
Constant Field Values
Method Detail

initialize

void initialize()
Initialize needed resources for cache. For example read cache index.


deinitialize

void deinitialize()
Clean up cache resources and, if needed, write cache definition/index somewhere.


get

byte[] get(java.lang.String cacheKey)
Get cached data.

Parameters:
cacheKey - key that was used for data caching
Returns:
cached data

cache

void cache(java.lang.String cacheKey,
           byte[] data,
           int cacheLevel)
Cache given data

Parameters:
cacheKey - key for the cached data
data - data to be cached
cacheLevel - at which level this data needs to be cached (memory, rms, etc).

contains

boolean contains(java.lang.String cacheKey)
Does this cache contain data for given cache key

Parameters:
cacheKey - cache key checked
Returns:
if data for key present

contains

boolean contains(java.lang.String cacheKey,
                 int cacheLevel)
Does the specified cache level contain given cache key

Parameters:
cacheKey - cache key to be checked
cacheLevel - which cache levels to check
Returns:
if data for key present