com.caucho.server.cache
Class Cache

java.lang.Object
  extended by com.caucho.server.cache.AbstractProxyCache
      extended by com.caucho.server.cache.Cache

public class Cache
extends AbstractProxyCache

Cached response.


Constructor Summary
Cache()
           
 
Method Summary
 void clear()
          Clears the cache.
 FilterChain createFilterChain(FilterChain next, WebApp app)
          Creates the filter.
 com.caucho.server.cache.ProxyCacheInode createInode()
          Creates a new writing inode.
 void destroy()
          Closes the cache.
 CacheItem[] getCacheableEntries(int max)
          Return most used connections.
 CacheItem[] getCachedEntries(int max)
          Return most used connections.
 long getHitCount()
          Returns the hit count.
static Cache getLocalCache()
          Returns the local cache.
 int getMaxEntrySize()
          Sets the maximum entry size for cache values.
 long getMemoryBlockHitCount()
          Returns the block hit count.
 long getMemoryBlockMissCount()
          Returns the miss count.
 long getMissCount()
          Returns the miss count.
 Path getPath()
          Returns the path from the cache directory.
 CacheItem[] getUncacheableEntries(int max)
          Return most used connections.
 CacheItem[] getUncachedEntries(int max)
          Return most used connections.
 void init()
          Initialize the cache.
 boolean isEnable()
          Return true if enabled.
 boolean isEnableRange()
          True if range handling is enabled.
 boolean isRewriteVaryAsPrivate()
          True if Vary headers should be rewritten as Cache-Control: private to work around IE's Vary handling bug.
 void setDir(Path path)
          Sets the path to the cache directory (backwards compatibility).
 void setDiskSize(Bytes size)
          Sets the disk size of the cache
 void setEnable(boolean isEnabled)
          Set true if enabled.
 void setEnableMmap(boolean isEnable)
           
 void setEnableRange(boolean enableRange)
          True if range handling is enabled.
 void setEntries(int entries)
          Sets the max number of entries.
 void setMaxEntrySize(Bytes size)
          Sets the maximum entry size for cache values.
 void setMemorySize(Bytes size)
          Sets the memory size of the cache
 void setPath(Path path)
          Sets the path to the cache directory.
 void setRewriteVaryAsPrivate(boolean rewrite)
          True if Vary headers should be rewritten as Cache-Control: private to work around IE's Vary handling bug.
 void setSize(Bytes size)
          Sets the size of the the cache (backwards compatibility).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Cache

public Cache()
      throws ConfigException
Throws:
ConfigException
Method Detail

getLocalCache

public static Cache getLocalCache()
Returns the local cache.


setPath

public void setPath(Path path)
Sets the path to the cache directory.

Overrides:
setPath in class AbstractProxyCache

getPath

public Path getPath()
Returns the path from the cache directory.

Overrides:
getPath in class AbstractProxyCache

setMemorySize

public void setMemorySize(Bytes size)
Sets the memory size of the cache

Overrides:
setMemorySize in class AbstractProxyCache

setDiskSize

public void setDiskSize(Bytes size)
Sets the disk size of the cache

Overrides:
setDiskSize in class AbstractProxyCache

setEnableMmap

@Configurable
public void setEnableMmap(boolean isEnable)
Overrides:
setEnableMmap in class AbstractProxyCache

setMaxEntrySize

public void setMaxEntrySize(Bytes size)
Sets the maximum entry size for cache values.


getMaxEntrySize

public int getMaxEntrySize()
Sets the maximum entry size for cache values.

Overrides:
getMaxEntrySize in class AbstractProxyCache

setEnable

public void setEnable(boolean isEnabled)
Set true if enabled.

Overrides:
setEnable in class AbstractProxyCache

isEnable

public boolean isEnable()
Return true if enabled.

Overrides:
isEnable in class AbstractProxyCache

setEntries

public void setEntries(int entries)
Sets the max number of entries.

Overrides:
setEntries in class AbstractProxyCache

setDir

public void setDir(Path path)
Sets the path to the cache directory (backwards compatibility).

Overrides:
setDir in class AbstractProxyCache

setSize

public void setSize(Bytes size)
Sets the size of the the cache (backwards compatibility).

Overrides:
setSize in class AbstractProxyCache

setEnableRange

public void setEnableRange(boolean enableRange)
True if range handling is enabled.


isEnableRange

public boolean isEnableRange()
True if range handling is enabled.


setRewriteVaryAsPrivate

public void setRewriteVaryAsPrivate(boolean rewrite)
True if Vary headers should be rewritten as Cache-Control: private to work around IE's Vary handling bug.

Overrides:
setRewriteVaryAsPrivate in class AbstractProxyCache

isRewriteVaryAsPrivate

public boolean isRewriteVaryAsPrivate()
True if Vary headers should be rewritten as Cache-Control: private to work around IE's Vary handling bug.


init

@PostConstruct
public void init()
          throws ConfigException,
                 java.io.IOException,
                 java.sql.SQLException
Initialize the cache.

Throws:
ConfigException
java.io.IOException
java.sql.SQLException

createFilterChain

public FilterChain createFilterChain(FilterChain next,
                                     WebApp app)
Creates the filter.

Overrides:
createFilterChain in class AbstractProxyCache

clear

public void clear()
Clears the cache.

Overrides:
clear in class AbstractProxyCache

createInode

public com.caucho.server.cache.ProxyCacheInode createInode()
Creates a new writing inode.


getHitCount

public long getHitCount()
Returns the hit count.

Overrides:
getHitCount in class AbstractProxyCache

getMissCount

public long getMissCount()
Returns the miss count.

Overrides:
getMissCount in class AbstractProxyCache

getMemoryBlockHitCount

public long getMemoryBlockHitCount()
Returns the block hit count.

Overrides:
getMemoryBlockHitCount in class AbstractProxyCache

getMemoryBlockMissCount

public long getMemoryBlockMissCount()
Returns the miss count.

Overrides:
getMemoryBlockMissCount in class AbstractProxyCache

getCacheableEntries

public CacheItem[] getCacheableEntries(int max)
Return most used connections.


getUncacheableEntries

public CacheItem[] getUncacheableEntries(int max)
Return most used connections.


getCachedEntries

public CacheItem[] getCachedEntries(int max)
Return most used connections.


getUncachedEntries

public CacheItem[] getUncachedEntries(int max)
Return most used connections.


destroy

public void destroy()
Closes the cache.