railo.commons.io.cache
Interface Cache

All Known Implementing Classes:
CacheSupport, EHCache, EHCacheLite, EHCacheRemote, EHCacheSupport, RamCache

public interface Cache


Field Summary
static String DEFAULT_CACHE_NAME
           
 
Method Summary
 boolean contains(String key)
          check if there is a entry inside the cache that match the given key
 List entries()
          Returns a List of entries containing in this cache Each element in the returned list is a CacheEntry.
 List entries(CacheEntryFilter filter)
          Returns a list of entries containing in this cache that match the given filter.
 List entries(CacheKeyFilter filter)
          Returns a list of entries containing in this cache that match the given filter.
 CacheEntry getCacheEntry(String key)
          return cache entry that match the key, throws a CacheException when entry does not exists or is stale
 CacheEntry getCacheEntry(String key, CacheEntry defaultValue)
          return cache entry that match the key or the defaultValue when entry does not exist
 Struct getCustomInfo()
          get all information data available for this cache
 Object getValue(String key)
          return value that match the key, throws a CacheException when entry does not exists or is stale
 Object getValue(String key, Object defaultValue)
          return value that match the key or the defaultValue when entry does not exist
 long hitCount()
          how many time was the cache accessed? this information is optional and depends on the implementation, when information is not available -1 is returned
 void init(String cacheName, Struct arguments)
          initialize the cache
 List keys()
          Returns a List of the keys contained in this cache.
 List keys(CacheEntryFilter filter)
          Returns a List of the keys contained in this cache that match the given filter.
 List keys(CacheKeyFilter filter)
          Returns a List of the keys contained in this cache that match the given filter.
 long missCount()
          how many time was the cache accessed for a record that does not exist? this information is optional and depends on the implementation, when information is not available -1 is returned
 void put(String key, Object value, Long idleTime, Long until)
          puts a cache entry to the cache, overwrite existing entries that already exists inside the cache with the same key
 int remove(CacheEntryFilter filter)
          remove all entries that match the given filter
 int remove(CacheKeyFilter filter)
          remove all entries that match the given filter
 boolean remove(String key)
          remove entry that match this key
 List values()
          Returns a List of values containing in this cache.
 List values(CacheEntryFilter filter)
          Returns a list of values containing in this cache that match the given filter.
 List values(CacheKeyFilter filter)
          Returns a list of values containing in this cache that match the given filter.
 

Field Detail

DEFAULT_CACHE_NAME

static final String DEFAULT_CACHE_NAME
See Also:
Constant Field Values
Method Detail

init

void init(String cacheName,
          Struct arguments)
          throws IOException
initialize the cache

Parameters:
arguments - configuration arguments
Throws:
CacheException
IOException

getCacheEntry

CacheEntry getCacheEntry(String key)
                         throws IOException
return cache entry that match the key, throws a CacheException when entry does not exists or is stale

Parameters:
key - key of the cache entry to get
Returns:
cache entry
Throws:
CacheException
IOException

getValue

Object getValue(String key)
                throws IOException
return value that match the key, throws a CacheException when entry does not exists or is stale

Parameters:
key - key of the value to get
Returns:
value
Throws:
CacheException
IOException

getCacheEntry

CacheEntry getCacheEntry(String key,
                         CacheEntry defaultValue)
return cache entry that match the key or the defaultValue when entry does not exist

Parameters:
key - key of the cache entry to get
Returns:
cache entry

getValue

Object getValue(String key,
                Object defaultValue)
return value that match the key or the defaultValue when entry does not exist

Parameters:
key - key of the value to get
Returns:
value

put

void put(String key,
         Object value,
         Long idleTime,
         Long until)
puts a cache entry to the cache, overwrite existing entries that already exists inside the cache with the same key

Parameters:
value -

contains

boolean contains(String key)
check if there is a entry inside the cache that match the given key

Parameters:
key -
Returns:
contains a value that match this key

remove

boolean remove(String key)
remove entry that match this key

Parameters:
key -
Returns:
returns if there was a removal

remove

int remove(CacheKeyFilter filter)
remove all entries that match the given filter

Parameters:
filter -
Returns:
returns the count of the removal or -1 if this information is not available

remove

int remove(CacheEntryFilter filter)
remove all entries that match the given filter

Parameters:
filter -
Returns:
returns the count of the removal or -1 if this information is not available

keys

List keys()
Returns a List of the keys contained in this cache. The set is NOT backed by the cache, so changes to the cache are NOT reflected in the set, and vice-versa.

Returns:
a set of the keys contained in this cache.

keys

List keys(CacheKeyFilter filter)
Returns a List of the keys contained in this cache that match the given filter. The set is NOT backed by the cache, so changes to the cache are NOT reflected in the set, and vice-versa.

Parameters:
filter -
Returns:
a set of the keys contained in this cache.

keys

List keys(CacheEntryFilter filter)
Returns a List of the keys contained in this cache that match the given filter. The set is NOT backed by the cache, so changes to the cache are NOT reflected in the set, and vice-versa.

Parameters:
filter -
Returns:
a set of the keys contained in this cache.

values

List values()
Returns a List of values containing in this cache. The set is NOT backed by the cache, so changes to the cache are NOT reflected in the set, and vice-versa.

Returns:
a set of the entries contained in this cache.

values

List values(CacheKeyFilter filter)
Returns a list of values containing in this cache that match the given filter. The set is NOT backed by the cache, so changes to the cache are NOT reflected in the set, and vice-versa.

Returns:
a set of the entries contained in this cache.

values

List values(CacheEntryFilter filter)
Returns a list of values containing in this cache that match the given filter. The set is NOT backed by the cache, so changes to the cache are NOT reflected in the set, and vice-versa.

Returns:
a set of the entries contained in this cache.

entries

List entries()
Returns a List of entries containing in this cache Each element in the returned list is a CacheEntry. The set is NOT backed by the cache, so changes to the cache are NOT reflected in the set, and vice-versa.

Returns:
a set of the entries contained in this cache.

entries

List entries(CacheKeyFilter filter)
Returns a list of entries containing in this cache that match the given filter. Each element in the returned set is a CacheEntry. The set is NOT backed by the cache, so changes to the cache are NOT reflected in the set, and vice-versa.

Returns:
a set of the entries contained in this cache.

entries

List entries(CacheEntryFilter filter)
Returns a list of entries containing in this cache that match the given filter. Each element in the returned set is a CacheEntry. The set is NOT backed by the cache, so changes to the cache are NOT reflected in the set, and vice-versa.

Returns:
a set of the entries contained in this cache.

hitCount

long hitCount()
how many time was the cache accessed? this information is optional and depends on the implementation, when information is not available -1 is returned

Returns:
access count

missCount

long missCount()
how many time was the cache accessed for a record that does not exist? this information is optional and depends on the implementation, when information is not available -1 is returned

Returns:
access count

getCustomInfo

Struct getCustomInfo()
get all information data available for this cache



Copyright © 2012 Railo