com.bankframe.services.cache
Class PerEntryTimeoutCachePolicy

java.lang.Object
  extended bycom.bankframe.services.cache.PerEntryTimeoutCachePolicy
All Implemented Interfaces:
CachePolicy

public class PerEntryTimeoutCachePolicy
extends java.lang.Object
implements CachePolicy

Author:
cdivilly This cache policy enables a timeout value to be specified for each entry in the cache. Call the setTimeout() methods to specify the timeout value for each entry. If a timeout value is not specified for a value then it will use the default timeout value. use the setDefaultTimeout() method to specify the default timeout value. This value is 60 seconds by default. Note: the entry must exist in the cache before you can specify its timeout value.

Constructor Summary
PerEntryTimeoutCachePolicy()
           
PerEntryTimeoutCachePolicy(long timeout)
           
 
Method Summary
 java.util.Set cleanup()
          This method returns a set containing the keys of values that have expired.
 long getDefaultTimeout()
          This method returns the default timeout value for cache entries
 boolean isCacheEntryValid(java.lang.Object key, java.lang.Object value)
          This method determines if the specified entry should be removed from the cache
 void remove(java.lang.Object key)
          This method signals the entry has been removed from the cache
 void remove(java.util.Set keySet)
          This method signals the set of entries has been removed from the cache
 void removeAll()
          This method signals that all entries have been removed from the cache
 void setDefaultTimeout(long l)
          This method sets the default timeout value for cache entries
 void setTimeout(java.lang.Object key, long timeout)
          This method sets the timeout for the specified cache entry
 void setTimeout(java.util.Set keys, long timeout)
          This method sets the timeout for the specified set of cache entries
 void updateCacheEntries(java.util.Map values)
          This method updates all the specified values
 void updateCacheEntry(java.lang.Object key, java.lang.Object value)
          This method updates the last access time for the specified entry
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PerEntryTimeoutCachePolicy

public PerEntryTimeoutCachePolicy()

PerEntryTimeoutCachePolicy

public PerEntryTimeoutCachePolicy(long timeout)
Method Detail

setTimeout

public void setTimeout(java.lang.Object key,
                       long timeout)
This method sets the timeout for the specified cache entry

Parameters:
key -
timeout -

setTimeout

public void setTimeout(java.util.Set keys,
                       long timeout)
This method sets the timeout for the specified set of cache entries

Parameters:
keys -
timeout -

cleanup

public java.util.Set cleanup()
This method returns a set containing the keys of values that have expired. If this method returns an empty set then there are no values to be removed. If this method returns a null value, then all values have expired

Specified by:
cleanup in interface CachePolicy
Returns:
set containing the keys

isCacheEntryValid

public boolean isCacheEntryValid(java.lang.Object key,
                                 java.lang.Object value)
This method determines if the specified entry should be removed from the cache

Specified by:
isCacheEntryValid in interface CachePolicy
Parameters:
key - the key from of object to check
value - the value of the object to check
Returns:
true if the entry has expired otherwise false

remove

public void remove(java.lang.Object key)
This method signals the entry has been removed from the cache

Specified by:
remove in interface CachePolicy
Parameters:
key - the key of the entry to remove from the meta data

remove

public void remove(java.util.Set keySet)
This method signals the set of entries has been removed from the cache

Specified by:
remove in interface CachePolicy

removeAll

public void removeAll()
This method signals that all entries have been removed from the cache

Specified by:
removeAll in interface CachePolicy

updateCacheEntries

public void updateCacheEntries(java.util.Map values)
This method updates all the specified values

Specified by:
updateCacheEntries in interface CachePolicy
Parameters:
values - a map of values to update

updateCacheEntry

public void updateCacheEntry(java.lang.Object key,
                             java.lang.Object value)
This method updates the last access time for the specified entry

Specified by:
updateCacheEntry in interface CachePolicy
Parameters:
key - the key of the cache entry to update
value - the value for this key

getDefaultTimeout

public long getDefaultTimeout()
This method returns the default timeout value for cache entries

Returns:

setDefaultTimeout

public void setDefaultTimeout(long l)
This method sets the default timeout value for cache entries

Parameters:
l -


Copyright © 2004 Siebel Systems, Inc. All rights reserved.