org.jgroups.blocks
Class LazyRemovalCache<K,V>
java.lang.Object
org.jgroups.blocks.LazyRemovalCache<K,V>
public class LazyRemovalCache<K,V>
- extends java.lang.Object
Cache which doesn't remove elements on remove(), removeAll() or retainAll(), but only removes elements when a
configurable size limit has been exceeded. In that case, all elements marked as removable and older than a
configurable time are evicted. Elements are marked as removable by remove(), removeAll() and retainAll(). When
an elements is marked as removable, but later reinserted, the mark is removed.
- Version:
- $Id: LazyRemovalCache.java,v 1.6 2010/04/22 12:13:06 belaban Exp $
- Author:
- Bela Ban
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
LazyRemovalCache
public LazyRemovalCache()
LazyRemovalCache
public LazyRemovalCache(int max_elements,
long max_age)
add
public void add(K key,
V val)
get
public V get(K key)
getByValue
public K getByValue(V val)
remove
public void remove(K key)
remove
public void remove(K key,
boolean force)
removeAll
public void removeAll(java.util.Collection<K> keys)
removeAll
public void removeAll(java.util.Collection<K> keys,
boolean force)
clear
public void clear(boolean force)
retainAll
public void retainAll(java.util.Collection<K> keys)
retainAll
public void retainAll(java.util.Collection<K> keys,
boolean force)
values
public java.util.Set<V> values()
contents
public java.util.Map<K,V> contents()
size
public int size()
printCache
public java.lang.String printCache()
printCache
public java.lang.String printCache(LazyRemovalCache.Printable print_function)
toString
public java.lang.String toString()
- Overrides:
toString in class java.lang.Object
removeMarkedElements
public void removeMarkedElements(boolean force)
- Removes elements marked as removable
- Parameters:
force - If set to true, all elements marked as 'removable' will get removed, regardless of expiration
removeMarkedElements
public void removeMarkedElements()
- Removes elements marked as removable
Copyright © 1998-2009 Bela Ban / Red Hat. All Rights Reserved.