rabbit.cache
Interface CacheEntry<K,V>


public interface CacheEntry<K,V>

A cached object.

Author:
Robert Olofsson

Method Summary
 long getCacheTime()
          Get the date this object was cached.
 V getDataHook(Cache<K,V> cache)
          Get the hooked data.
 long getExpires()
          Get the expiry-date of our file
 long getHookSize()
          Get the disc size of the hook, if any
 long getId()
          Get the id of the entry.
 K getKey()
          Get the key were holding data for
 long getKeySize()
          Get the disk size of the key, if any
 long getSize()
          Get the size of our file
 void setDataHook(V o)
          Sets the data hook for this cache object.
 void setExpires(long d)
          Sets the expirydate of our data
 void setSize(long size)
          Sets the size of our data file
 

Method Detail

getId

long getId()
Get the id of the entry.

Returns:
the id of the entry.

getKey

K getKey()
         throws CacheException
Get the key were holding data for

Returns:
the key object
Throws:
CacheException

getCacheTime

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

Returns:
a date (millis since the epoch).

getSize

long getSize()
Get the size of our file

Returns:
the size of our data

getKeySize

long getKeySize()
Get the disk size of the key, if any


getHookSize

long getHookSize()
Get the disc size of the hook, if any


setSize

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

Parameters:
size - the new Size

getExpires

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

Returns:
the expiry date of our data

setExpires

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

Parameters:
d - the new expiry-date.

getDataHook

V getDataHook(Cache<K,V> cache)
              throws CacheException
Get the hooked data.

Parameters:
cache - the Cache this entry lives in.
Returns:
the the hooked data.
Throws:
CacheException

setDataHook

void setDataHook(V 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.