org.apache.commons.cache
Class LRUEvictionPolicy
java.lang.Object
org.apache.commons.cache.LRUEvictionPolicy
- All Implemented Interfaces:
- Serializable, Iterator, CachedObjectIterator, EvictionPolicy, RetrievalListener, StorageListener
public class LRUEvictionPolicy
- extends Object
- implements EvictionPolicy, StorageListener, RetrievalListener, CachedObjectIterator
tk.
- Version:
- $Id: LRUEvictionPolicy.java 155435 2005-02-26 13:17:27Z dirkv $
- Author:
- Rodney Waldhoff
- See Also:
- Serialized Form
Method Summary |
protected void |
addToList(WListableObject cur)
|
void |
cleared()
|
void |
cleared(Serializable key)
|
Serializable |
getEvictionCandidate()
|
Serializable[] |
getEvictionCandidates(int n)
|
CachedObjectInfo |
getNext()
|
boolean |
hasNext()
|
Object |
next()
|
void |
notRetrieved(Serializable key)
|
void |
notStored(Serializable key,
Serializable val,
Long expiresAt,
Long cost,
Serializable group)
|
void |
remove()
|
protected void |
removeFromList(WListableObject cur)
|
void |
retrieved(Serializable key)
|
void |
retrieveRequested(Serializable key)
|
void |
setCache(Cache c)
Sets my cache. |
void |
stored(Serializable key,
Serializable val,
Long expiresAt,
Long cost,
Serializable group)
|
void |
storeRequested(Serializable key,
Serializable val,
Long expiresAt,
Long cost,
Serializable group)
|
String |
toString()
|
void |
unsetCache()
Unsets my cache. |
_hash
protected transient HashMap _hash
_leastRecent
protected transient WListableObject _leastRecent
_mostRecent
protected transient WListableObject _mostRecent
_current
protected transient WListableObject _current
_canRemove
protected boolean _canRemove
_cache
public Cache _cache
_objsbetweennaps
protected int _objsbetweennaps
_sleeptimemillis
protected long _sleeptimemillis
LRUEvictionPolicy
public LRUEvictionPolicy()
LRUEvictionPolicy
public LRUEvictionPolicy(int objsbetweennaps,
long sleeptimemillis)
addToList
protected void addToList(WListableObject cur)
removeFromList
protected void removeFromList(WListableObject cur)
hasNext
public boolean hasNext()
- Specified by:
hasNext
in interface Iterator
- Specified by:
hasNext
in interface CachedObjectIterator
getNext
public CachedObjectInfo getNext()
throws NoSuchElementException
- Specified by:
getNext
in interface CachedObjectIterator
- Throws:
NoSuchElementException
next
public Object next()
throws NoSuchElementException
- Specified by:
next
in interface Iterator
- Specified by:
next
in interface CachedObjectIterator
- Throws:
NoSuchElementException
remove
public void remove()
throws NoSuchElementException,
IllegalStateException
- Specified by:
remove
in interface Iterator
- Specified by:
remove
in interface CachedObjectIterator
- Throws:
NoSuchElementException
IllegalStateException
setCache
public void setCache(Cache c)
- Sets my cache.
- Specified by:
setCache
in interface EvictionPolicy
unsetCache
public void unsetCache()
- Unsets my cache.
- Specified by:
unsetCache
in interface EvictionPolicy
storeRequested
public void storeRequested(Serializable key,
Serializable val,
Long expiresAt,
Long cost,
Serializable group)
- Specified by:
storeRequested
in interface StorageListener
notStored
public void notStored(Serializable key,
Serializable val,
Long expiresAt,
Long cost,
Serializable group)
- Specified by:
notStored
in interface StorageListener
stored
public void stored(Serializable key,
Serializable val,
Long expiresAt,
Long cost,
Serializable group)
- Specified by:
stored
in interface StorageListener
cleared
public void cleared(Serializable key)
- Specified by:
cleared
in interface StorageListener
cleared
public void cleared()
- Specified by:
cleared
in interface StorageListener
retrieveRequested
public void retrieveRequested(Serializable key)
- Specified by:
retrieveRequested
in interface RetrievalListener
retrieved
public void retrieved(Serializable key)
- Specified by:
retrieved
in interface RetrievalListener
notRetrieved
public void notRetrieved(Serializable key)
- Specified by:
notRetrieved
in interface RetrievalListener
getEvictionCandidate
public Serializable getEvictionCandidate()
- Specified by:
getEvictionCandidate
in interface EvictionPolicy
getEvictionCandidates
public Serializable[] getEvictionCandidates(int n)
- Specified by:
getEvictionCandidates
in interface EvictionPolicy
toString
public String toString()
- Overrides:
toString
in class Object
Copyright © 2001-2010 The Apache Software Foundation. All Rights Reserved.