org.egothor.cache.multiQueue
Class MultiQueueEntry<K>

java.lang.Object
  extended by org.egothor.cache.multiQueue.MultiQueueEntry<K>
Type Parameters:
K - type of the stored key

public class MultiQueueEntry<K>
extends java.lang.Object

Represents a node that holds information about key, access and expire time, frequency and queue number.


Constructor Summary
MultiQueueEntry(K key, byte queue, long accessTime, long lifeTime)
          Constructor for the MultiQueueEntry object.
 
Method Summary
 long getExpireTime()
          Returns the expire time of the node.
 long getFrequency()
          Returns the value of frequency counter of this node.
 K getKey()
          Gets the key this node is associated with.
 byte getQueue()
          Returns the number of the queue this node resides in.
 long incrementFrequency()
          Increments the frequency counter of this node.
 long lastAccessTime()
          Returns the last access time of the node
 long setExpireTime(long newExpireTime)
          Sets the expire time of the node.
 byte setQueue(byte newQueue)
          Sets the number of queue this node is currently in.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MultiQueueEntry

public MultiQueueEntry(K key,
                       byte queue,
                       long accessTime,
                       long lifeTime)
Constructor for the MultiQueueEntry object.

Parameters:
key - key this node is associated with
queue - number of queue this node is in
accessTime - access time of the node
lifeTime - life time of the node
Method Detail

getKey

public K getKey()
Gets the key this node is associated with.

Returns:
key this node is associated with

getQueue

public byte getQueue()
Returns the number of the queue this node resides in.

Returns:
number of queue this node resides in

setQueue

public byte setQueue(byte newQueue)
Sets the number of queue this node is currently in.

Parameters:
newQueue - new number of queue this node resides in.
Returns:
previous number of queue this node resided in

getFrequency

public long getFrequency()
Returns the value of frequency counter of this node.

Returns:
value of frequency counter of this node

incrementFrequency

public long incrementFrequency()
Increments the frequency counter of this node.

Returns:
new frequency associated with the node

lastAccessTime

public long lastAccessTime()
Returns the last access time of the node

Returns:
last access time of the node

getExpireTime

public long getExpireTime()
Returns the expire time of the node.

Returns:
expire time of the node

setExpireTime

public long setExpireTime(long newExpireTime)
Sets the expire time of the node.

Parameters:
newExpireTime - new expire time to set the node to
Returns:
previous expire time of the node