Jive Forums API (5.5.20.2-oracle) Developer Javadocs

com.jivesoftware.forum.database
Class DatabaseCacheManager

java.lang.Object
  extended by com.jivesoftware.forum.database.DatabaseCacheManager

public class DatabaseCacheManager
extends java.lang.Object

Central cache management of all caches used by Jive Forums. Cache sizes and max lifetimes are stored as children of the following Jive property values. For example, the category cache size (in bytes) is set using the property cache.categoryCache.size and the category cache max lifetime (in milliseconds) is set using the property cache.categoryCache.maxLifetime:

All size values should be in bytes and all max lifetime values in milliseconds. For sites with extreme traffic (500K or more forum page views per day) a short-term query cache can be enabled to that cache invalidations don't happen more than once every X seconds (where X is the lifetime of objects in the short-term cache). To enable the short-term query cache, set the cache.shortTermQueryCache.time Jive property (expiration time in milliseconds) -- for example, to 10000, so that query cache invalidations only happen once every 10 seconds.


Field Summary
 Cache announcementCache
          A cache for announcement data.
 Cache attachmentCache
          A cache for attachment objects.
 Cache categoryCache
          A cache for Category objects.
 Cache forumCache
          A cache for Forum objects.
 Cache forumIndexCache
          A cache to map forum indexes to message ID's.
 Cache forumNNTPNameCache
          A cache for mapping forum NNTP names to forum ID.
 Cache messageCache
          A cache for ForumMessage objects.
 Cache privateMessageCache
          A cache for PrivateMessage objects.
 Cache privateMessageFolderCache
          A cache for PrivateMessageFolder objects.
 QueryCache queryCache
          A cache for database query results generated by the use of ResultFilters.
 Cache questionCache
          A cache for questions.
 Cache readTrackerCache
          A cache for read tracker data.
 Cache rewardCache
          A cache for reward data.
 Cache shortTermQueryCache
          A short-term cache for query results.
 Cache threadCache
          A cache for ForumThread objects.
 Cache treeWalkerCache
          A cache for TreeWalker objects (represents the three structure of messages in a thread).
 Cache userMessageCountCache
          A cache of user message counts.
 Cache watchCache
          A cache for Watch objects.
 
Constructor Summary
DatabaseCacheManager()
          Creates a new cache manager.
 
Method Summary
 void announcementPut(long announcementID, DbAnnouncement announcement)
           
 void announcementPut(java.lang.String key, long[] announcement)
           
 void announcementRemove(long announcementID)
           
 void announcementRemove(java.lang.String key)
           
 void forumIndexPut(java.lang.String key, long messageID)
           
 void forumIndexRemove(java.lang.String key)
           
 DbAttachment getAttachment(long attachmentID)
           
 DbAttachment getAttachment(long attachmentID, java.sql.Connection con)
           
 DbForum getForum(long forumID)
           
 DbForumCategory getForumCategory(long categoryID)
           
 void initQueryCache()
           
 boolean isShortTermQueryCacheEnabled()
          Returns true if the short term query cache is enabled.
 void messagePut(long id, ForumMessage message)
           
 void messageRemove(long id)
           
 java.lang.Object queryGet(QueryCacheKey key)
           
 void queryPut(QueryCacheKey countKey, java.lang.Object value)
           
 void queryRemove(int objectType, long objectID)
           
 void setShortTermQueryCacheEnabled(boolean shortTermQueryCacheEnabled)
          Enables or disables the short-term query cache.
 void setShortTermQueryCacheLifetime(long stqcLifetime)
          Sets the expiration time in milliseconds for entries in the short term query cache.
 void threadPut(long id, ForumThread thread)
           
 void threadRemove(long id)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

categoryCache

public Cache categoryCache
A cache for Category objects.


forumCache

public Cache forumCache
A cache for Forum objects.


forumNNTPNameCache

public Cache forumNNTPNameCache
A cache for mapping forum NNTP names to forum ID.


threadCache

public Cache threadCache
A cache for ForumThread objects.


treeWalkerCache

public Cache treeWalkerCache
A cache for TreeWalker objects (represents the three structure of messages in a thread).


messageCache

public Cache messageCache
A cache for ForumMessage objects.


privateMessageCache

public Cache privateMessageCache
A cache for PrivateMessage objects.


privateMessageFolderCache

public Cache privateMessageFolderCache
A cache for PrivateMessageFolder objects.


forumIndexCache

public Cache forumIndexCache
A cache to map forum indexes to message ID's. Each key is a String in the form "forumID-index", e.g. "23-5798". Value are Long message ID's.


queryCache

public QueryCache queryCache
A cache for database query results generated by the use of ResultFilters. Queries will either be for counts of objects, or lists of objects.


shortTermQueryCache

public Cache shortTermQueryCache
A short-term cache for query results.


watchCache

public Cache watchCache
A cache for Watch objects.


userMessageCountCache

public Cache userMessageCountCache
A cache of user message counts. This greatly helps for skins that show the number of messages a user has posted next to each of their messages.


attachmentCache

public Cache attachmentCache
A cache for attachment objects.


rewardCache

public Cache rewardCache
A cache for reward data.


readTrackerCache

public Cache readTrackerCache
A cache for read tracker data.


announcementCache

public Cache announcementCache
A cache for announcement data.


questionCache

public Cache questionCache
A cache for questions.

Constructor Detail

DatabaseCacheManager

public DatabaseCacheManager()
Creates a new cache manager.

Method Detail

initQueryCache

public void initQueryCache()

isShortTermQueryCacheEnabled

public boolean isShortTermQueryCacheEnabled()
Returns true if the short term query cache is enabled. It is only enabled if the Jive property "cache.shortTermQueryCache.time" has been set.

Returns:
true if the short term query cache is enabled.

setShortTermQueryCacheEnabled

public void setShortTermQueryCacheEnabled(boolean shortTermQueryCacheEnabled)
Enables or disables the short-term query cache.

Parameters:
shortTermQueryCacheEnabled - true if the short term query cache should be enabled.

setShortTermQueryCacheLifetime

public void setShortTermQueryCacheLifetime(long stqcLifetime)
Sets the expiration time in milliseconds for entries in the short term query cache.

Parameters:
stqcLifetime - the expiration time for entries in the short term query cache.

getForumCategory

public DbForumCategory getForumCategory(long categoryID)
                                 throws ForumCategoryNotFoundException
Throws:
ForumCategoryNotFoundException

getForum

public DbForum getForum(long forumID)
                 throws ForumNotFoundException
Throws:
ForumNotFoundException

getAttachment

public DbAttachment getAttachment(long attachmentID)
                           throws AttachmentNotFoundException
Throws:
AttachmentNotFoundException

getAttachment

public DbAttachment getAttachment(long attachmentID,
                                  java.sql.Connection con)
                           throws AttachmentNotFoundException
Throws:
AttachmentNotFoundException

threadPut

public void threadPut(long id,
                      ForumThread thread)

messagePut

public void messagePut(long id,
                       ForumMessage message)

threadRemove

public void threadRemove(long id)

queryRemove

public void queryRemove(int objectType,
                        long objectID)

queryPut

public void queryPut(QueryCacheKey countKey,
                     java.lang.Object value)

forumIndexPut

public void forumIndexPut(java.lang.String key,
                          long messageID)

forumIndexRemove

public void forumIndexRemove(java.lang.String key)

messageRemove

public void messageRemove(long id)

queryGet

public java.lang.Object queryGet(QueryCacheKey key)

announcementPut

public void announcementPut(long announcementID,
                            DbAnnouncement announcement)

announcementRemove

public void announcementRemove(long announcementID)

announcementPut

public void announcementPut(java.lang.String key,
                            long[] announcement)

announcementRemove

public void announcementRemove(java.lang.String key)

Jive Forums Project Page

Copyright © 1999-2006 Jive Software.