Protomatter Software v1.1.8

com.protomatter.util
Class SoftReferenceCache

java.lang.Object
  |
  +--com.protomatter.util.SoftReferenceCache
All Implemented Interfaces:
Cache
Direct Known Subclasses:
ExpiringSoftReferenceCache

public class SoftReferenceCache
extends java.lang.Object
implements Cache

A cache that uses soft references. Values in this cache are expired by the VM in reponse to memory needs. For more information on how this works, see the JavaDoc for the java.lang.ref package.


Constructor Summary
SoftReferenceCache()
          Create a new cache.
 
Method Summary
 void clear()
          Clear the entire cache.
 void clear(java.lang.Object key)
          Clear the value in the cache at the given key.
 java.lang.Object get(java.lang.Object key)
          Get a value from the cache at the given key.
 void put(java.lang.Object key, java.lang.Object val)
          Put a value into the cache, possibly clobbering the old value if one exists.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SoftReferenceCache

public SoftReferenceCache()
Create a new cache.
Method Detail

put

public void put(java.lang.Object key,
                java.lang.Object val)
Put a value into the cache, possibly clobbering the old value if one exists.
Specified by:
put in interface Cache

get

public java.lang.Object get(java.lang.Object key)
Get a value from the cache at the given key.
Specified by:
get in interface Cache
Returns:
The cached value, or null if no value exists.

clear

public void clear(java.lang.Object key)
Clear the value in the cache at the given key.
Specified by:
clear in interface Cache

clear

public void clear()
Clear the entire cache.
Specified by:
clear in interface Cache

Protomatter Software v1.1.8
Copyright 1998-2002 Nate Sammons

Protomatter Software v1.1.8 http://protomatter.sourceforge.net/1.1.8