com.continuent.tungsten.common.cache
Class CacheNode<T>

java.lang.Object
  extended by com.continuent.tungsten.common.cache.CacheNode<T>

public class CacheNode<T>
extends java.lang.Object

Node for a single entry in an indexed LRU cache. The node contains threaded references to earlier and later nodes in the LRU list.

Author:
Robert Hodges

Constructor Summary
CacheNode(java.lang.String key, T value)
          Create node and set initial access time.
 
Method Summary
 T get()
          Return the node value.
 CacheNode<T> getAfter()
          Return the after (older) node in the LRU list.
 CacheNode<T> getBefore()
          Return the before (newer) node or null in LRU list.
 java.lang.String getKey()
           
 long getLastAccessMillis()
          Returns time of last access.
 void release()
          Release resources associated with the value.
 void setAfter(CacheNode<T> next)
          Set the after node in the LRU list.
 void setBefore(CacheNode<T> previous)
          Set the before node in the LRU list.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CacheNode

public CacheNode(java.lang.String key,
                 T value)
Create node and set initial access time.

Method Detail

release

public void release()
Release resources associated with the value. Must be overridden by clients to implement type-specific resource management. The node is unusable after this call.


getKey

public java.lang.String getKey()

get

public T get()
Return the node value.


getLastAccessMillis

public long getLastAccessMillis()
Returns time of last access.


getBefore

public CacheNode<T> getBefore()
Return the before (newer) node or null in LRU list.


setBefore

public void setBefore(CacheNode<T> previous)
Set the before node in the LRU list.


getAfter

public CacheNode<T> getAfter()
Return the after (older) node in the LRU list.


setAfter

public void setAfter(CacheNode<T> next)
Set the after node in the LRU list.