org.cofax
Class CofaxCache

java.lang.Object
  |
  +--org.cofax.CofaxCache

public class CofaxCache
extends java.lang.Object

Provides HTML response caching capabilies for CofaxServlet

Author:
Rajiv Pant, Karl Martino, Sam Cohen, Hung Dao

Field Summary
 java.lang.String lastError
           
 
Constructor Summary
CofaxCache(int maxUrlsToCount, int maxUrlsToCache, int refreshCacheInterval)
          Initializes variables.
 
Method Summary
 boolean addPageToCache(java.lang.String id, CofaxPage page)
          Adds an item to cache and keys it by it's ID.
 void clear()
          Clears the cache of items and hit counts.
 long getCacheHits()
           
 long getCacheRequests()
           
 java.util.Date getClearedTimeTotal()
           
 int getHitCount(java.lang.String id)
          Gets the hit count of a page in cache.
 boolean getIsMaxStoreReached()
           
 boolean getIsMaxTrackReached()
           
 int getMaxStore()
           
 java.util.Date getMaxStoreReached()
           
 int getMaxTrack()
           
 java.util.Date getMaxTrackReached()
           
 int getMaxTrackTurnOver()
           
 CofaxPage getPage(java.lang.String id)
          Gets a page from cache.
 long getRefreshInterval()
           
 int getStoredCount()
           
 java.util.HashMap getStoreHash()
           
 int getTrackedCount()
           
 int getTrackedTotal()
          Gets the total number of items counted.
 java.util.HashMap getTrackHash()
           
 boolean incrementHitCount(java.lang.String id)
          Increments the hit count of an item in cache.
 boolean isPageCached(java.lang.String id)
          Checks to see if an item is in cached.
 java.util.ArrayList removeByPartialUrl(java.lang.String partialUrl)
          Removes an item from cache based upon a partial ID.
 boolean removeFromCache(java.lang.String id)
          Removes an item from cache.
 boolean shouldPageBeCached(java.lang.String id)
          Determines if an item should be cached.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

lastError

public java.lang.String lastError
Constructor Detail

CofaxCache

public CofaxCache(int maxUrlsToCount,
                  int maxUrlsToCache,
                  int refreshCacheInterval)
Initializes variables.
Method Detail

getStoredCount

public int getStoredCount()

getTrackedCount

public int getTrackedCount()

getMaxTrack

public int getMaxTrack()

getMaxStore

public int getMaxStore()

getRefreshInterval

public long getRefreshInterval()

getStoreHash

public java.util.HashMap getStoreHash()

getTrackHash

public java.util.HashMap getTrackHash()

getClearedTimeTotal

public java.util.Date getClearedTimeTotal()

getCacheRequests

public long getCacheRequests()

getCacheHits

public long getCacheHits()

getMaxTrackReached

public java.util.Date getMaxTrackReached()

getMaxStoreReached

public java.util.Date getMaxStoreReached()

getIsMaxTrackReached

public boolean getIsMaxTrackReached()

getIsMaxStoreReached

public boolean getIsMaxStoreReached()

getMaxTrackTurnOver

public int getMaxTrackTurnOver()

clear

public void clear()
Clears the cache of items and hit counts.

isPageCached

public boolean isPageCached(java.lang.String id)
Checks to see if an item is in cached. If that item is expired, it removes it from cache.

removeFromCache

public boolean removeFromCache(java.lang.String id)
Removes an item from cache.

incrementHitCount

public boolean incrementHitCount(java.lang.String id)
Increments the hit count of an item in cache. Maintains size maintenance.

getHitCount

public int getHitCount(java.lang.String id)
Gets the hit count of a page in cache.

addPageToCache

public boolean addPageToCache(java.lang.String id,
                              CofaxPage page)
Adds an item to cache and keys it by it's ID. In the case of a template, it's ID is it's file system path. For packageTags it is a tagName For result sets it is the URL called.

removeByPartialUrl

public java.util.ArrayList removeByPartialUrl(java.lang.String partialUrl)
Removes an item from cache based upon a partial ID.

getPage

public CofaxPage getPage(java.lang.String id)
Gets a page from cache.

shouldPageBeCached

public boolean shouldPageBeCached(java.lang.String id)
Determines if an item should be cached.

getTrackedTotal

public int getTrackedTotal()
Gets the total number of items counted.


Copyright 2001 KnightRidder.com. All Rights Reserved.