net.dontdrinkandroot.cache
Interface CustomTtlCache<K,V>

All Superinterfaces:
Cache<K,V>
All Known Implementing Classes:
AbstractIndexedDiskCache, AbstractMapBackedCustomTtlCache, BufferedSerializableIndexedDiskCache, ByteArrayIndexedDiskCache, LruBufferedSerializableIndexedDiskCache, MemoryCache, NoopCache, SerializableIndexedDiskCache

public interface CustomTtlCache<K,V>
extends Cache<K,V>

A Cache that permits storing entries with an individual time to live and an individual idle time.

Author:
Philip W. Sorst

Field Summary
 
Fields inherited from interface net.dontdrinkandroot.cache.Cache
UNLIMITED_IDLE_TIME
 
Method Summary
<T extends V>
T
put(K key, T data, long timeToLive)
          Store an entry in the cache with a specific time to live.
<T extends V>
T
put(K key, T data, long timeToLive, long maxIdleTime)
          Store an entry in the cache with a specific time to live and max idle time.
<T extends V>
T
putWithErrors(K key, T data, long timeToLive)
          Store an entry in the cache with a specific time to live.
<T extends V>
T
putWithErrors(K key, T data, long timeToLive, long maxIdleTime)
          Store an entry in the cache with a specific time to live and max idle time.
 
Methods inherited from interface net.dontdrinkandroot.cache.Cache
cleanUp, delete, get, getDefaultMaxIdleTime, getDefaultTtl, getMetaData, getName, getStatistics, getWithErrors, put, putWithErrors
 

Method Detail

put

<T extends V> T put(K key,
                    T data,
                    long timeToLive)
Store an entry in the cache with a specific time to live. Any errors are swallowed, use put(Object, Object, long) if you want to handle them.

Parameters:
id - A unique identifier.
data - The data to store, make sure that you don't alter the data after it has been put to cache as (depending on the implementation) this might lead to altering the entry in the cache. Use the returned entry instead.
timeToLive - The time (in milliseconds) after which the entry expires.
Returns:
The entry that has been stored in the cache. It is save to alter this as implementations as implementations make sure that this is always a copy.

putWithErrors

<T extends V> T putWithErrors(K key,
                              T data,
                              long timeToLive)
                          throws CacheException
Store an entry in the cache with a specific time to live.

Parameters:
id - A unique identifier.
data - The data to store, make sure that you don't alter the data after it has been put to cache as (depending on the implementation) this might lead to altering the entry in the cache. Use the returned entry instead.
timeToLive - The time (in milliseconds) after which the entry expires.
Returns:
The entry that has been stored in the cache. It is save to alter this as implementations as implementations make sure that this is always a copy.
Throws:
CacheException - Thrown if the storage fails.

put

<T extends V> T put(K key,
                    T data,
                    long timeToLive,
                    long maxIdleTime)
Store an entry in the cache with a specific time to live and max idle time. Any errors are swallowed, use putWithErrors(Object, Object, long) if you want to handle them.

Parameters:
id - A unique identifier.
data - The data to store, make sure that you don't alter the data after it has been put to cache as (depending on the implementation) this might lead to altering the entry in the cache. Use the returned entry instead.
timeToLive - The time (in milliseconds) after which the entry expires.
maxIdleTime - The time (in milliseconds) that an entry may idle (not being accessed) before being expunged.
Returns:
The entry that has been stored in the cache. It is save to alter this as implementations as implementations make sure that this is always a copy.
Throws:
CacheException - Thrown if the storage fails.

putWithErrors

<T extends V> T putWithErrors(K key,
                              T data,
                              long timeToLive,
                              long maxIdleTime)
                          throws CacheException
Store an entry in the cache with a specific time to live and max idle time.

Parameters:
id - A unique identifier.
data - The data to store, make sure that you don't alter the data after it has been put to cache as (depending on the implementation) this might lead to altering the entry in the cache. Use the returned entry instead.
timeToLive - The time (in milliseconds) after which the entry expires.
maxIdleTime - The time (in milliseconds) that an entry may idle (not being accessed) before being expunged.
Returns:
The entry that has been stored in the cache. It is save to alter this as implementations as implementations make sure that this is always a copy.
Throws:
CacheException - Thrown if the storage fails.


Copyright © 2013 dontdrinkandroot. All Rights Reserved.