org.codehaus.gpars

groovyx.gpars.memoize
[Java] Class LRUProtectionStorage

java.lang.Object
  java.util.AbstractMap
      java.util.HashMap
          java.util.LinkedHashMap
              groovyx.gpars.memoize.LRUProtectionStorage

@java.lang.Deprecated
public final class LRUProtectionStorage
extends java.util.LinkedHashMap

Protects stored resources from eviction from memory following the LRU (Last Recently Used) strategy. If the maximum size has been reached all newly added elements will cause the oldest element to be removed from the storage in order not to exceed the maximum capacity. The touch method can be used to renew an element and move it to the from the LRU queue.

Authors:
Vaclav Pech Date: Jun 22, 2010


Field Summary
private int maxSize

private static long serialVersionUID

 
Constructor Summary
LRUProtectionStorage(int maxSize)

 
Method Summary
java.lang.Object clone()

protected boolean removeEldestEntry(java.util.Map$Entry eldest)

void touch(java.lang.Object key, java.lang.Object value)

Performs a shallow clone

 
Methods inherited from class java.util.LinkedHashMap
java.util.LinkedHashMap#get(java.lang.Object), java.util.LinkedHashMap#clear(), java.util.LinkedHashMap#containsValue(java.lang.Object), java.util.LinkedHashMap#put(java.lang.Object, java.lang.Object), java.util.LinkedHashMap#values(), java.util.LinkedHashMap#clone(), java.util.LinkedHashMap#entrySet(), java.util.LinkedHashMap#putAll(java.util.Map), java.util.LinkedHashMap#remove(java.lang.Object), java.util.LinkedHashMap#keySet(), java.util.LinkedHashMap#containsKey(java.lang.Object), java.util.LinkedHashMap#isEmpty(), java.util.LinkedHashMap#size(), java.util.LinkedHashMap#equals(java.lang.Object), java.util.LinkedHashMap#toString(), java.util.LinkedHashMap#hashCode(), java.util.LinkedHashMap#wait(long, int), java.util.LinkedHashMap#wait(long), java.util.LinkedHashMap#wait(), java.util.LinkedHashMap#getClass(), java.util.LinkedHashMap#notify(), java.util.LinkedHashMap#notifyAll()
 
Methods inherited from class java.util.HashMap
java.util.HashMap#get(java.lang.Object), java.util.HashMap#put(java.lang.Object, java.lang.Object), java.util.HashMap#values(), java.util.HashMap#clone(), java.util.HashMap#clear(), java.util.HashMap#entrySet(), java.util.HashMap#putAll(java.util.Map), java.util.HashMap#remove(java.lang.Object), java.util.HashMap#containsValue(java.lang.Object), java.util.HashMap#keySet(), java.util.HashMap#containsKey(java.lang.Object), java.util.HashMap#isEmpty(), java.util.HashMap#size(), java.util.HashMap#equals(java.lang.Object), java.util.HashMap#toString(), java.util.HashMap#hashCode(), java.util.HashMap#wait(long, int), java.util.HashMap#wait(long), java.util.HashMap#wait(), java.util.HashMap#getClass(), java.util.HashMap#notify(), java.util.HashMap#notifyAll()
 

Field Detail

maxSize

private final int maxSize


serialVersionUID

private static final long serialVersionUID


 
Constructor Detail

LRUProtectionStorage

public LRUProtectionStorage(int maxSize)


 
Method Detail

clone

@java.lang.SuppressWarnings
@java.lang.Override
public java.lang.Object clone()


removeEldestEntry

@java.lang.Overrideput(key, value);
protected boolean removeEldestEntry(@java.lang.SuppressWarnings java.util.Map$Entry eldest)


touch

@java.lang.SuppressWarningsreturn super.clone();
public void touch(java.lang.Object key, java.lang.Object value)
Performs a shallow clone
Returns:
The cloned instance


 

Copyright © 2008–2013 Václav Pech. All Rights Reserved.