com.compoundtheory.objectcache
Class CachedObject

java.lang.Object
  extended by com.compoundtheory.objectcache.CachedObject

public class CachedObject
extends java.lang.Object

Class that wraps an object that is being cached and provide meta data information about it's cached state

Author:
Mark Mandel

Constructor Summary
CachedObject(java.lang.ref.SoftReference softRef, int secondsPersisted, int secondsAccessedTimeout)
          sets up an empty cached object
 
Method Summary
 int calculateFitness()
          Calculates the fitness of this object being persisted in the pool
 void clear()
           
 java.lang.Object getCFC()
           
 java.lang.ref.SoftReference getCfcSoftRef()
           
 java.util.Date getCreated()
           
 java.util.Date getExpired()
           
 int getHits()
           
 boolean hasExpired()
          Has the cached object expired?
 void hit()
          Hit to cached object
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CachedObject

public CachedObject(java.lang.ref.SoftReference softRef,
                    int secondsPersisted,
                    int secondsAccessedTimeout)
sets up an empty cached object

Parameters:
softRef - The soft reference that contains the CFC
secondsPersisted - The number of seconds to persist the object *
Method Detail

clear

public void clear()

calculateFitness

public int calculateFitness()
Calculates the fitness of this object being persisted in the pool

Returns:
the fitness of the object

hit

public void hit()
Hit to cached object


hasExpired

public boolean hasExpired()
Has the cached object expired?

Returns:
if it has expired

getCreated

public java.util.Date getCreated()

getHits

public int getHits()

getCFC

public java.lang.Object getCFC()

getCfcSoftRef

public java.lang.ref.SoftReference getCfcSoftRef()

getExpired

public java.util.Date getExpired()