com.anthonyeden.lib.cache
Class CacheEntry

java.lang.Object
  extended bycom.anthonyeden.lib.cache.CacheEntry

public class CacheEntry
extends java.lang.Object

A single entry in a cache. CacheEntry objects can include a specific time to live which overrides the default time to live. If the time to live is -1 then the default is used.

Since:
1.1
Author:
Anthony Eden

Constructor Summary
CacheEntry(java.lang.Object object, long insertTime)
          Construct a new CacheEntry.
CacheEntry(java.lang.Object object, long insertTime, int ttl)
          Construct a new CacheEntry with the given time to live.
 
Method Summary
 long getInsertTime()
          Get the insert time.
 long getLastRequestTime()
          Get the last request time.
 java.lang.Object getObject()
          Get the cached object.
 int getTTL()
          Get the time to live.
 void setLastRequestTime(long lastRequestTime)
          Set the last request time.
 void setTTL(int ttl)
          Set the time to live
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CacheEntry

public CacheEntry(java.lang.Object object,
                  long insertTime)
Construct a new CacheEntry.

Parameters:
object - The cached object
insertTime - The time when the object was inserted

CacheEntry

public CacheEntry(java.lang.Object object,
                  long insertTime,
                  int ttl)
Construct a new CacheEntry with the given time to live.

Parameters:
object - The cached object
insertTime - The time when the object was inserted
ttl - The time to live of the entry
Method Detail

getObject

public java.lang.Object getObject()
Get the cached object.

Returns:
The cached object

getInsertTime

public long getInsertTime()
Get the insert time.

Returns:
The insert time

getTTL

public int getTTL()
Get the time to live.

Returns:
The time to live

setTTL

public void setTTL(int ttl)
Set the time to live

Parameters:
ttl - The time to live

getLastRequestTime

public long getLastRequestTime()
Get the last request time.

Returns:
The last request time

setLastRequestTime

public void setLastRequestTime(long lastRequestTime)
Set the last request time.

Parameters:
lastRequestTime - The last request time


Copyright (c) 2000-2003 Anthony Eden. All Rights Reserved.