org.alfresco.util
Class ExpiringValueCache

java.lang.Object
  extended by org.alfresco.util.ExpiringValueCache
All Implemented Interfaces:
java.io.Serializable

public class ExpiringValueCache
extends java.lang.Object
implements java.io.Serializable

Simple cache of a single Object value.

The object placed in the cache will automatically be discarded after a timeout value.

See Also:
Serialized Form

Constructor Summary
ExpiringValueCache()
          Default constructor.
ExpiringValueCache(long timeout)
          Constructor
 
Method Summary
 void clear()
          Clear the cache value
 java.lang.Object get()
          Get the cached object.
 void put(java.lang.Object value)
          Put a value into the cache.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExpiringValueCache

public ExpiringValueCache()
Default constructor. Uses the default timeout of 1 minute.


ExpiringValueCache

public ExpiringValueCache(long timeout)
Constructor

Parameters:
timeout - Timeout in milliseconds before cached value is discarded
Method Detail

put

public void put(java.lang.Object value)
Put a value into the cache. The item will be return from the associated get() method until the timeout expires then null will be returned.

Parameters:
value - The object to store in the cache

get

public java.lang.Object get()
Get the cached object. The set item will be returned until it expires, then null will be returned.

Returns:
cached object or null if not set or expired.

clear

public void clear()
Clear the cache value



Copyright © 2005 - 2010 Alfresco Software, Inc. All Rights Reserved.