FileDocCategorySizeDatePackage
ConcurrentCache.javaAPI DocApache Tomcat 6.0.14780Fri Jul 20 04:20:32 BST 2007org.apache.el.util

ConcurrentCache

public final class ConcurrentCache extends Object

Fields Summary
private final int
size
private final Map
eden
private final Map
longterm
Constructors Summary
public ConcurrentCache(int size)

		this.size = size;
		this.eden = new ConcurrentHashMap<K,V>(size);
		this.longterm = new WeakHashMap<K,V>(size);
	
Methods Summary
public Vget(K k)

		V v = this.eden.get(k);
		if (v == null) {
			v = this.longterm.get(k);
			if (v != null) {
				this.eden.put(k, v);
			}
		}
		return v;
	
public voidput(K k, V v)

		if (this.eden.size() >= size) {
			this.longterm.putAll(this.eden);
			this.eden.clear();
		}
		this.eden.put(k, v);