public class scancache extends Module implements scancacheInterface
| Modifier and Type | Field and Description |
|---|---|
static int |
MAX_CACHE_POOL_SIZE
Maximum size of a pool's memory cache.
|
(package private) MMBase |
mmbase
reference to MMBase module, used to retrieve netfiles and pagemakers builders
that support caching.
|
(package private) Hashtable<String,LRUHashtable<String,String>> |
pools
Contains the memory caches for the cache pools.
|
(package private) boolean |
status
Determines whether the cache module is active.
|
(package private) LRUHashtable<String,Integer> |
timepool
Contains the last date (as an
Integer) a file was stored in a pool. |
configurationPath, getMaintainerFunction, getVersionFunction, properties, STATE_START_TIMEdescription, guiName, namefunctions, getFunctions| Constructor and Description |
|---|
scancache()
Scancache module constructor.
|
| Modifier and Type | Method and Description |
|---|---|
String |
get(String poolName,
String key,
scanpage sp)
Retrieve a file from the indicated pool's cache.
|
String |
get(String poolName,
String key,
String line,
scanpage sp)
Retrieve a file from the indicated pool's cache.
|
long |
getExpireDate(String poolName,
String key,
String expireStr)
getExpireDate.
|
long |
getLastModDate(String poolName,
String key)
getLastModDate.
|
String |
getModuleInfo()
Retrieve a description of the module's function.
|
boolean |
getStatus()
Returns the status of this module.
|
(package private) String |
getWriteHeaders(String value,
String mimeType)
Returns the headers for a .asis file to be stored for a "PAGE" cache.
|
void |
init()
Initializes the module.
|
fileInfo |
loadFile(String pool,
String filename)
loads a file from the disk.
|
String |
newput(String poolName,
javax.servlet.http.HttpServletResponse res,
String key,
String value,
String mimeType)
Store a file in the indicated pool's cache (both on file system and in the memory cache).
|
String |
newput2(String poolName,
String key,
String value,
int cachetype,
String mimeType)
Store a file in the indicated pool's cache (both in file and in the memory cache).
|
void |
onload()
Event that should be triggered when the module is loaded.
|
String |
put(String poolName,
String key,
String value)
Store a file in the indicated pool's cache (both on file and in the memory cache).
|
void |
remove(String poolName,
String key)
Removes an entry from the cache pool (both the file on disk and in the memory cache).
|
void |
shutdown()
Event that sh*ould be triggered when the module is shut down.
|
void |
signalNetFileSrv(String filename)
Signal the NetFileServ builder that the .asis file for a page has changed.
|
void |
unload()
Event that should be triggered when the module is unloaded.
|
addInitParameters, getInitParameter, getInitParameter, getInitParameter, getInitParameters, getInitParameters, getMaintainer, getModule, getModule, getModule, getModule, getModuleLoader, getModuleReader, getModuleReader, getModules, getState, getStates, getVersion, hasModule, hasStarted, loadInitParameters, loadInitParameters, maintainance, setInitParameter, setMaintainer, setState, setVersion, shutdownModules, startModule, startModulesgetDefaultLocale, getDescription, getDescription, getGUIName, getGUIName, getLocalizedDescription, getLocalizedGUIName, getName, setDescription, setDescription, setGUIName, setGUIName, setLocalizedDescription, setLocalizedGUIName, setNameaddFunction, createParameters, getFunction, getFunctions, getFunctionValue, newFunctionInstancepublic static final int MAX_CACHE_POOL_SIZE
Hashtable<String,LRUHashtable<String,String>> pools
LRUHashtable<String,Integer> timepool
Integer) a file was stored in a pool.
The key to retrieve the time is poolname+filekey (where a filekey is generally the file URI).
There is a limit to the number of values stored in this pool. This means if you have
more then 4 pooltypes you have to bump that value or suffer performance degredationMMBase mmbase
boolean status
public void onload()
public void shutdown()
public void unload()
public void init()
init in interface scancacheInterfaceinit in class Modulepublic String get(String poolName, String key, scanpage sp)
get in interface scancacheInterfacepoolName - name of the cache pool, either "HENK" or "PAGE"key - URL of the page to retrievenull if no entry was found
(i.e. cache was empty or poolname was invalid).public String get(String poolName, String key, String line, scanpage sp)
get in interface scancacheInterfacepoolName - name of the cache pool, expected (but not verified) are "HENK" or "PAGE"key - URL of the page to retrieveline - the expiration value, either the expiration value in seconds or the word 'NOEXPIRE'. Due to
legacy this value needs to be closed with a '>'.
If the parameter is empty a default value is used.null if no entry was foundpublic long getExpireDate(String poolName, String key, String expireStr)
getExpireDate in interface scancacheInterfacepoolName - key - expireStr - public long getLastModDate(String poolName, String key)
getLastModDate in interface scancacheInterfacepoolName - key - public String newput(String poolName, javax.servlet.http.HttpServletResponse res, String key, String value, String mimeType)
newput in interface scancacheInterfacepoolName - name of the cache pool, either "HENK" or "PAGE"res - response object for retrieving headers (used by mmbase.org?)
only needed for cachepool "PAGE"key - URL of the page to storevalue - the page content to storemimeType - the page's mime type, only needed for cachepool "PAGE"null if no entry was found
(i.e. cache was empty or poolName was invalid).public String newput2(String poolName, String key, String value, int cachetype, String mimeType)
newput2 in interface scancacheInterfacepoolName - name of the cache pool, either "HENK" or "PAGE"key - URL of the page to storevalue - the page content to storecachetype - only needed for cachepool "PAGE".
If 0, no file transfer is performed. Otherwise the NetFileSrv builder is
invoked to start the VWM that handles the transfer.mimeType - the page's mime type, only needed for cachepool "PAGE"null if no entry was found
(i.e. cache was empty or poolName was invalid).public String put(String poolName, String key, String value)
put in interface scancacheInterfacepoolName - name of the cache poolkey - URL of the page to storevalue - the page content to storenull if no entry was foundpublic String getModuleInfo()
getModuleInfo in class Modulepublic fileInfo loadFile(String pool, String filename)
pool - The name of the poolfilename - the name of the filefileInfo object.public void signalNetFileSrv(String filename)
filename - the .asis filename that changedString getWriteHeaders(String value, String mimeType)
value - page content, used to set the Content-length header.mimeType - the mimetype of the page. default (if unspecified) is text/html; iso-8859-1Stringpublic void remove(String poolName, String key)
remove in interface scancacheInterfacepoolName - name of cache pool, expected (but not verified) "HENK" or "PAGE"key - URL of the page to removepublic boolean getStatus()
true if the module is active, false otherwiseMMBase 1.9-SNAPSHOT - ${javadoctimestamp}