Jive Forums API (5.5.20.2-oracle) Developer Javadocs

com.jivesoftware.util
Class CacheObject

java.lang.Object
  extended by com.jivesoftware.util.CacheObject

public final class CacheObject
extends java.lang.Object

Wrapper for all objects put into cache. It's primary purpose is to maintain references to the linked lists that maintain the creation time of the object and the ordering of the most used objects. This class is optimized for speed rather than strictly correct encapsulation.


Field Summary
 LinkedListNode ageListNode
          A reference to the node in the age order list.
 LinkedListNode lastAccessedListNode
          A reference to the node in the cache order list.
 java.lang.Object object
          Underlying object wrapped by the CacheObject.
 int readCount
          A count of the number of times the object has been read from cache.
 int size
          The size of the Cacheable object.
 
Constructor Summary
CacheObject(java.lang.Object object, int size)
          Creates a new cache object wrapper.
 
Method Summary
 boolean equals(java.lang.Object o)
           
 int hashCode()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

object

public java.lang.Object object
Underlying object wrapped by the CacheObject.


size

public int size
The size of the Cacheable object. The size of the Cacheable object is only computed once when it is added to the cache. This makes the assumption that once objects are added to cache, they are mostly read-only and that their size does not change significantly over time.


lastAccessedListNode

public LinkedListNode lastAccessedListNode
A reference to the node in the cache order list. We keep the reference here to avoid linear scans of the list. Every time the object is accessed, the node is removed from its current spot in the list and moved to the front.


ageListNode

public LinkedListNode ageListNode
A reference to the node in the age order list. We keep the reference here to avoid linear scans of the list. The reference is used if the object has to be deleted from the list.


readCount

public int readCount
A count of the number of times the object has been read from cache.

Constructor Detail

CacheObject

public CacheObject(java.lang.Object object,
                   int size)
Creates a new cache object wrapper. The size of the Cacheable object must be passed in in order to prevent another possibly expensive lookup by querying the object itself for its size.

Parameters:
object - the underlying Object to wrap.
size - the size of the Cachable object in bytes.
Method Detail

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

Jive Forums Project Page

Copyright © 1999-2006 Jive Software.