TV-Browser 3.3.3 API

util.misc
Class SoftReferenceCache<T,K>

java.lang.Object
  extended by util.misc.SoftReferenceCache<T,K>

public class SoftReferenceCache<T,K>
extends java.lang.Object

This class implements a Cache using soft references. As soon as the garbage collector tries to remove an object, it gets removed from the cache.

Since:
2.7

Constructor Summary
SoftReferenceCache()
           
 
Method Summary
 void cleanUp()
          Cleanup the cache.
 void clear()
          Clear the cache
 boolean containsKey(T key)
          Checks if the cache contains a specific key
 K get(T key)
          Get the value from the Cache
 void put(T key, K object)
          Put a object into the cache
 void remove(T key)
          Remove item from cache
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SoftReferenceCache

public SoftReferenceCache()
Method Detail

get

public K get(T key)
Get the value from the Cache

Parameters:
key - get value for this key

put

public void put(T key,
                K object)
Put a object into the cache

Parameters:
key - key for this object
object - object to store in the cache

remove

public void remove(T key)
Remove item from cache

Parameters:
key - remove item that references this key

clear

public void clear()
Clear the cache


cleanUp

public void cleanUp()
Cleanup the cache. Every garbage collected item must be removed


containsKey

public boolean containsKey(T key)
Checks if the cache contains a specific key

Parameters:
key - search for this key
Returns:
true if this cache contains this key

TV-Browser 3.3.3 API

TV-Browser 3.3.3, Copyright (C) 2004-2008 TV-Browser Team (dev@tvbrowser.org)