railo.commons.io.cache
Interface Cache


public interface Cache


Method Summary
 boolean contains(java.lang.String key)
          check if there is a entry inside the cache that match the given key
 CacheEntry getCacheEntry(java.lang.String key)
          return cache entry that match the key, throws a CacheException when entry does not exists or is stale
 CacheEntry getCacheEntry(java.lang.String key, CacheEntry defaultValue)
          return cache entry that match the key or the defaultValue when entry does not exist
 java.lang.Object getValue(java.lang.String key)
          return value that match the key, throws a CacheException when entry does not exists or is stale
 java.lang.Object getValue(java.lang.String key, java.lang.Object defaultValue)
          return value that match the key or the defaultValue when entry does not exist
 void init(Struct arguments)
          initialize the cache
 java.util.List keys()
          Returns a List of the keys contained in this cache.
 java.util.List keys(CacheEntryFilter filter)
          Returns a List of the keys contained in this cache that match the given filter.
 java.util.List keys(CacheKeyFilter filter)
          Returns a List of the keys contained in this cache that match the given filter.
 void put(java.lang.String key, java.lang.Object value, java.lang.Long idleTime, java.lang.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(java.lang.String key)
          remove entry that match this key
 java.util.List values()
          Returns a List of values containing in this cache Each element in the returned set is a CacheEntry.
 java.util.List values(CacheEntryFilter filter)
          Returns a list of values containing in this cache that match the given filter.
 java.util.List values(CacheKeyFilter filter)
          Returns a list of values containing in this cache that match the given filter.
 

Method Detail

init

public void init(Struct arguments)
initialize the cache

Parameters:
arguments - configuration arguments

getCacheEntry

public CacheEntry getCacheEntry(java.lang.String key)
                         throws CacheException
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

getValue

public java.lang.Object getValue(java.lang.String key)
                          throws CacheException
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

getCacheEntry

public CacheEntry getCacheEntry(java.lang.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

public java.lang.Object getValue(java.lang.String key,
                                 java.lang.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

public void put(java.lang.String key,
                java.lang.Object value,
                java.lang.Long idleTime,
                java.lang.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

public boolean contains(java.lang.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

public boolean remove(java.lang.String key)
remove entry that match this key

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

remove

public 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

public 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

public java.util.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

public java.util.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

public java.util.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

public java.util.List values()
Returns a List of values containing in this cache 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.

values

public java.util.List values(CacheKeyFilter filter)
Returns a list of values 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.

values

public java.util.List values(CacheEntryFilter filter)
Returns a list of values 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.