com.caucho.distcache
Interface ByteStreamCache

All Known Implementing Classes:
AbstractCache, CacheImpl, ClusterCache, LocalCache, TransientCache

public interface ByteStreamCache

Interface for a distributed cache.


Method Summary
 boolean compareAndPut(java.lang.Object key, long oldVersion, java.io.InputStream is)
          Updates the cache if the old value hash matches the current value.
 boolean compareAndRemove(java.lang.Object key, long oldVersion)
          Removes the entry from the cache if the current entry matches the hash
 boolean get(java.lang.Object key, java.io.OutputStream os)
          Fills a stream for the content with the given key.
 ExtCacheEntry<?,?> getExtCacheEntry(java.lang.Object key)
          Returns the cache entry for the object with the given key.
 ExtCacheEntry<?,?> peekExtCacheEntry(java.lang.Object key)
          Returns the cache entry for the object with the given key, without triggering a load.
 ExtCacheEntry<?,?> put(java.lang.Object key, java.io.InputStream is, long accessedExpireTimeout, long modifiedExpireTimeout)
          Puts a new item in the cache.
 ExtCacheEntry<?,?> put(java.lang.Object key, java.io.InputStream is, long accessedExpireTimeout, long modifiedExpireTimeout, int flags)
          Puts a new item in the cache.
 boolean remove(java.lang.Object key)
          Removes the entry from the cache
 

Method Detail

get

boolean get(java.lang.Object key,
            java.io.OutputStream os)
            throws java.io.IOException
Fills a stream for the content with the given key.

Throws:
java.io.IOException

getExtCacheEntry

ExtCacheEntry<?,?> getExtCacheEntry(java.lang.Object key)
Returns the cache entry for the object with the given key.


peekExtCacheEntry

ExtCacheEntry<?,?> peekExtCacheEntry(java.lang.Object key)
Returns the cache entry for the object with the given key, without triggering a load.


put

ExtCacheEntry<?,?> put(java.lang.Object key,
                       java.io.InputStream is,
                       long accessedExpireTimeout,
                       long modifiedExpireTimeout)
                       throws java.io.IOException
Puts a new item in the cache.

Parameters:
key - the key of the item to put
is - stream to contain the value
Throws:
java.io.IOException

put

ExtCacheEntry<?,?> put(java.lang.Object key,
                       java.io.InputStream is,
                       long accessedExpireTimeout,
                       long modifiedExpireTimeout,
                       int flags)
                       throws java.io.IOException
Puts a new item in the cache.

Parameters:
key - the key of the item to put
is - stream to contain the value
Throws:
java.io.IOException

compareAndPut

boolean compareAndPut(java.lang.Object key,
                      long oldVersion,
                      java.io.InputStream is)
                      throws java.io.IOException
Updates the cache if the old value hash matches the current value. A null value for the old value hash only adds the entry if it's new

Parameters:
key - the key to compare
oldVersion - the version of the old value, returned by getEntry
Returns:
true if the update succeeds, false if it fails
Throws:
java.io.IOException

remove

boolean remove(java.lang.Object key)
Removes the entry from the cache


compareAndRemove

boolean compareAndRemove(java.lang.Object key,
                         long oldVersion)
Removes the entry from the cache if the current entry matches the hash