rabbit.cache
Class NCacheEntry

java.lang.Object
  extended by rabbit.cache.NCacheEntry
All Implemented Interfaces:
java.io.Externalizable, java.io.Serializable

public class NCacheEntry
extends java.lang.Object
implements java.io.Externalizable

A cached object.

See Also:
Serialized Form

Constructor Summary
NCacheEntry()
          Not to be used, for externalizable only.
NCacheEntry(java.lang.Object key, long id)
          Create a new CacheEntry for given key and filename
 
Method Summary
 long getCacheTime()
          Get the date this object was cached.
 java.lang.Object getDataHook(NCache cache)
          Get the hooked data.
 long getExpires()
          Get the expiry-date of our file
 long getId()
          Get the id of our entry.
 java.lang.Object getKey()
          Get the key were holding data for
protected  java.lang.Object getRealDataHook()
          Get the real data hook
 long getSize()
          Get the size of our file
 void readExternal(java.io.ObjectInput in)
          Read the cache entry from the object input.
 void setCacheTime(java.util.Date date)
          Set the date this object was cached.
 void setDataHook(java.lang.Object o)
          Sets the data hook for this cache object.
 void setExpires(long d)
          Sets the expirydate of our data
protected  void setKey(java.lang.Object key)
          Set the key were holding data for
 void setSize(long size)
          Sets the size of our data
 void writeExternal(java.io.ObjectOutput out)
          Write the object to the object output.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NCacheEntry

public NCacheEntry()
Not to be used, for externalizable only.


NCacheEntry

public NCacheEntry(java.lang.Object key,
                   long id)
Create a new CacheEntry for given key and filename

Parameters:
key - the key for the object.
id - the identity of this entry
Method Detail

setKey

protected void setKey(java.lang.Object key)
Set the key were holding data for

Parameters:
key - the key we have data for

getKey

public java.lang.Object getKey()
Get the key were holding data for

Returns:
the keyobject

getCacheTime

public long getCacheTime()
Get the date this object was cached.

Returns:
a date.

setCacheTime

public void setCacheTime(java.util.Date date)
Set the date this object was cached.

Parameters:
date - the date.

getSize

public long getSize()
Get the size of our file

Returns:
the size of our data

setSize

public void setSize(long size)
Sets the size of our data

Parameters:
size - the new Size

getExpires

public long getExpires()
Get the expiry-date of our file

Returns:
the expiry date of our data

setExpires

public void setExpires(long d)
Sets the expirydate of our data

Parameters:
d - the new expiry-date.

getId

public long getId()
Get the id of our entry.

Returns:
the id of the entry.

getRealDataHook

protected java.lang.Object getRealDataHook()
Get the real data hook


getDataHook

public java.lang.Object getDataHook(NCache cache)
Get the hooked data.

Parameters:
cache - the NCache this entry lives in.
Returns:
the the hooked data.

setDataHook

public void setDataHook(java.lang.Object o)
Sets the data hook for this cache object. Since it is not always possible to make the key hold this...

Parameters:
o - the new data.

readExternal

public void readExternal(java.io.ObjectInput in)
                  throws java.io.IOException,
                         java.lang.ClassNotFoundException
Read the cache entry from the object input.

Specified by:
readExternal in interface java.io.Externalizable
Throws:
java.io.IOException
java.lang.ClassNotFoundException

writeExternal

public void writeExternal(java.io.ObjectOutput out)
                   throws java.io.IOException
Write the object to the object output.

Specified by:
writeExternal in interface java.io.Externalizable
Throws:
java.io.IOException