FileDocCategorySizeDatePackage
HashtableCache.javaAPI DocHibernate 3.2.51811Thu Apr 21 02:57:20 BST 2005org.hibernate.cache

HashtableCache

public class HashtableCache extends Object implements Cache
A lightweight implementation of the Cache interface
author
Gavin King

Fields Summary
private final Map
hashtable
private final String
regionName
Constructors Summary
public HashtableCache(String regionName)

	
	   
		this.regionName = regionName;
	
Methods Summary
public voidclear()

		hashtable.clear();
	
public voiddestroy()


	
public java.lang.Objectget(java.lang.Object key)

		return hashtable.get(key);
	
public longgetElementCountInMemory()

		return hashtable.size();
	
public longgetElementCountOnDisk()

		return 0;
	
public java.lang.StringgetRegionName()

		return regionName;
	
public longgetSizeInMemory()

		return -1;
	
public intgetTimeout()

		return Timestamper.ONE_MS * 60000; //ie. 60 seconds
	
public voidlock(java.lang.Object key)

		// local cache, so we use synchronization
	
public longnextTimestamp()

		return Timestamper.next();
	
public voidput(java.lang.Object key, java.lang.Object value)

		hashtable.put(key, value);
	
public java.lang.Objectread(java.lang.Object key)

		return hashtable.get(key);
	
public voidremove(java.lang.Object key)

		hashtable.remove(key);
	
public java.util.MaptoMap()

		return Collections.unmodifiableMap(hashtable);
	
public java.lang.StringtoString()

		return "HashtableCache(" + regionName + ')";
	
public voidunlock(java.lang.Object key)

		// local cache, so we use synchronization
	
public voidupdate(java.lang.Object key, java.lang.Object value)

		put(key, value);