|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.bankframe.services.cache.LruCachePolicy
This class implements a Least Recently Used cache policy. Whenever the number of Cache elements grows to more than the value of maxSize, the least recently used entries will be removed. This policy supports the following configurable properties:
maxSize
The maximum number of entries permitted in the cachethrashAmount
The number of entries to remove when the maximum size is exceeded
Constructor Summary | |
LruCachePolicy()
This Constructor This creates a default instance of the policy where maxSize has a value of 100 and the thrash amount is set to zero (i.e only enought elements will be removed from the cache to bring it back to the max size). |
|
LruCachePolicy(int maxSize)
This constructor creates a Lru policy with the given maximum size and a 0 thrash value |
|
LruCachePolicy(int maxSize,
int thrashAmount)
This constructor creates a Lru policy with the given maximum size and the given thrash value |
Method Summary | |
java.util.Set |
cleanup()
This method returns a set containing the keys of values that have expired. |
void |
configure(BankFrameResource config)
|
int |
getMaxSize()
This method gets the maximum size defined by this policy |
int |
getThrashAmount()
|
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 |
setMaxSize(int maxSize)
This method sets the maximum size of the Cache. |
void |
setThrashAmount(int i)
|
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 |
public LruCachePolicy()
public LruCachePolicy(int maxSize)
maxSize
- The maximum number of elements permitted in the Cachepublic LruCachePolicy(int maxSize, int thrashAmount)
maxSize
- The maximum number of elements permitted in the CachethrashAmount
- the thrashAmount to useMethod Detail |
public java.util.Set cleanup()
CachePolicy
cleanup
in interface CachePolicy
CachePolicy.cleanup()
public int getMaxSize()
public boolean isCacheEntryValid(java.lang.Object key, java.lang.Object value)
CachePolicy
isCacheEntryValid
in interface CachePolicy
CachePolicy.isCacheEntryValid(Object, Object)
public void remove(java.lang.Object key)
CachePolicy
remove
in interface CachePolicy
CachePolicy.remove(Object)
public void remove(java.util.Set keySet)
CachePolicy
remove
in interface CachePolicy
CachePolicy.remove(Set)
public void removeAll()
CachePolicy
removeAll
in interface CachePolicy
CachePolicy.removeAll()
public void setMaxSize(int maxSize)
maxSize
- the new maximum size allowed by this policypublic void updateCacheEntries(java.util.Map values)
CachePolicy
updateCacheEntries
in interface CachePolicy
CachePolicy.updateCacheEntries(Map)
public void updateCacheEntry(java.lang.Object key, java.lang.Object value)
CachePolicy
updateCacheEntry
in interface CachePolicy
CachePolicy.updateCacheEntry(Object, Object)
public void configure(BankFrameResource config)
configure
in interface ConfigurableCachePolicy
public int getThrashAmount()
public void setThrashAmount(int i)
i
-
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |