Jive Forums API (5.5.20.2-oracle) Developer Javadocs

com.jivesoftware.forum.database.querycache
Class QueryCacheKey

java.lang.Object
  extended by com.jivesoftware.forum.database.querycache.QueryCacheKey
All Implemented Interfaces:
Cacheable, com.tangosol.io.ExternalizableLite, com.tangosol.net.cache.KeyAssociation, java.io.Serializable

public class QueryCacheKey
extends java.lang.Object
implements java.io.Serializable, Cacheable, com.tangosol.io.ExternalizableLite, com.tangosol.net.cache.KeyAssociation

Represents a key in the QueryCache. All information needed to reload a cache entry is included in the key.

See Also:
Serialized Form

Constructor Summary
QueryCacheKey()
          Constructor for internal use only.
QueryCacheKey(int objectType, long objectID, CachedPreparedStatement sql, int blockID)
          Creates a new QueryCacheKey.
QueryCacheKey(int objectType, long objectID, CachedPreparedStatement sql, int blockID, int queryCacheStrategyType)
          Creates a new QueryCacheKey.
 
Method Summary
static java.lang.String createIDKey(int objectType, long objectID)
          Creates a new id key representing the supplied object type and id.
 boolean equals(java.lang.Object o)
           
 java.lang.Object getAssociatedKey()
          Returns the idKey, which is used by coherence to associate entries.
 int getBlockID()
          Returns the blockID of the key, or -1 if there is not a blockID.
 int getCachedSize()
          Returns the approximate size of the Object in bytes.
 java.lang.String getIDKey()
          Returns the id key which associates this instance with a specific object in the system.
 long getObjectID()
          Returns the objectID of the key.
 int getObjectType()
          Returns the object type associated with the objectID.
 int getQueryCacheStrategyType()
          Returns one of the constants in QueryCacheStrategyFactory defining a type of QueryCacheStrategy to use, or -1 if no strategy is needed.
 CachedPreparedStatement getSQL()
          Returns the sql query of the key.
 int hashCode()
           
 void readExternal(java.io.DataInput in)
           
 java.lang.String toString()
           
 void writeExternal(java.io.DataOutput out)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

QueryCacheKey

public QueryCacheKey(int objectType,
                     long objectID,
                     CachedPreparedStatement sql,
                     int blockID)
Creates a new QueryCacheKey.

Parameters:
objectType - the type of the object: JiveGlobals.COMMUNITY or JiveGlobals.THREAD.
objectID - the id of the parent object to which the query cache entry corresponds.
sql - the sql query for the cache entry data.
blockID - the block ID of the entry, or -1 if there is not block ID.

QueryCacheKey

public QueryCacheKey(int objectType,
                     long objectID,
                     CachedPreparedStatement sql,
                     int blockID,
                     int queryCacheStrategyType)
Creates a new QueryCacheKey.

Parameters:
objectType - the type of the object: JiveGlobals.COMMUNITY or JiveGlobals.THREAD.
objectID - the id of the parent object to which the query cache entry corresponds.
sql - the sql query for the cache entry data.
blockID - the block ID of the entry, or -1 if there is not block ID.
queryCacheStrategyType - one of the constants in QueryCacheStrategyFactory defining a type of QueryCacheStrategy to use. Set to QueryCacheStrategyFactory.NO_STRATEGY to use no strategy at all.

QueryCacheKey

public QueryCacheKey()
Constructor for internal use only.

Method Detail

getObjectType

public int getObjectType()
Returns the object type associated with the objectID. Possible values are JiveGlobals.FORUM_CATEGORY, JiveGlobals.FORUM, and JiveGlobals.THREAD.

Returns:
the object type..

getObjectID

public long getObjectID()
Returns the objectID of the key.

Returns:
the objectID.

getSQL

public CachedPreparedStatement getSQL()
Returns the sql query of the key.

Returns:
the sql.

getBlockID

public int getBlockID()
Returns the blockID of the key, or -1 if there is not a blockID.

Returns:
the blockID, or -1 if there is not a blockID.

getIDKey

public java.lang.String getIDKey()
Returns the id key which associates this instance with a specific object in the system.

Returns:
the id key which associates this instance with a specific object in the system.

getAssociatedKey

public java.lang.Object getAssociatedKey()
Returns the idKey, which is used by coherence to associate entries.

Specified by:
getAssociatedKey in interface com.tangosol.net.cache.KeyAssociation
Returns:
the idKey, which is used by coherence to associate entries.

getQueryCacheStrategyType

public int getQueryCacheStrategyType()
Returns one of the constants in QueryCacheStrategyFactory defining a type of QueryCacheStrategy to use, or -1 if no strategy is needed.

Returns:
one of the constants in QueryCacheStrategyFactory defining a type of QueryCacheStrategy to use, or -1 if no strategy is needed.

createIDKey

public static java.lang.String createIDKey(int objectType,
                                           long objectID)
Creates a new id key representing the supplied object type and id.

Parameters:
objectType - the type code of the object. One of the fields in JiveConstants.
objectID - the id of the object
Returns:
the id key.

readExternal

public void readExternal(java.io.DataInput in)
                  throws java.io.IOException
Specified by:
readExternal in interface com.tangosol.io.ExternalizableLite
Throws:
java.io.IOException

writeExternal

public void writeExternal(java.io.DataOutput out)
                   throws java.io.IOException
Specified by:
writeExternal in interface com.tangosol.io.ExternalizableLite
Throws:
java.io.IOException

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

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getCachedSize

public int getCachedSize()
Description copied from interface: Cacheable
Returns the approximate size of the Object in bytes. The size should be considered to be a best estimate of how much memory the Object occupies and may be based on empirical trials or dynamic calculations.

Specified by:
getCachedSize in interface Cacheable
Returns:
the size of the Object in bytes.

Jive Forums Project Page

Copyright © 1999-2006 Jive Software.