org.mmbase.module
Class cache

java.lang.Object
  extended by org.mmbase.util.functions.FunctionProvider
      extended by org.mmbase.util.functions.DescribedFunctionProvider
          extended by org.mmbase.module.Module
              extended by org.mmbase.module.cache
All Implemented Interfaces:
Descriptor, cacheInterface

public class cache
extends Module
implements cacheInterface

Simple file cache system that can be used by any servlet

Version:
$Id: cache.java 35335 2009-05-21 08:14:41Z michiel $
Author:
$Author: nklasens $
Application:
cache [utility, implementation]
Javadoc:
Move:
org.mmbase.cache.implementation
Rename:
Cache

Field Summary
(package private)  int hits
           
(package private)  LRUHashtable<Object,Object> lines
           
(package private)  int miss
           
(package private)  boolean state_up
           
 
Fields inherited from class org.mmbase.module.Module
configurationPath, getMaintainerFunction, getVersionFunction, properties, STATE_START_TIME
 
Fields inherited from class org.mmbase.util.functions.DescribedFunctionProvider
description, guiName, name
 
Fields inherited from class org.mmbase.util.functions.FunctionProvider
functions, getFunctions
 
Constructor Summary
cache()
          Simple file cache system that can be used by any servlet
 
Method Summary
 boolean clear()
          Clear the whole cache in one go
 cacheline get(Object wanted)
          Try to get a cacheline from cache, returns null if not found
 String getModuleInfo()
          Provide some info on the module; By default, this returns the module description for the default locale
 Map<String,String> getStates()
          Returns the module's runtime-generated state information as a unmodifiable map with name-value pairs.
 void init()
          Initializes the module.
 LRUHashtable<Object,Object> lines()
          Old interface to the inner table, will be removed soon
 void onload()
          prepares the module when loaded.
 cacheline put(Object key, Object value)
          Try to put a cacheline in cache, returns old one if available In all other cases returns null.
(package private)  void readParams()
           
 void reload()
           
 cacheline remove(Object key)
          Remove the entry identified by key from the cache
 void shutdown()
          Shuts down the module.
 Map<String,String> state()
           
 void unload()
           
 
Methods inherited from class org.mmbase.module.Module
addInitParameters, checkModules, getInitParameter, getInitParameter, getInitParameter, getInitParameters, getInitParameters, getMaintainer, getModule, getModule, getModule, getModule, getModuleLoader, getModuleReader, getModuleReader, getModules, getState, getVersion, hasModule, hasStarted, loadInitParameters, loadInitParameters, maintainance, setInitParameter, setMaintainer, setState, setVersion, shutdownModules, startModule, startModules
 
Methods inherited from class org.mmbase.util.functions.DescribedFunctionProvider
getDefaultLocale, getDescription, getDescription, getGUIName, getGUIName, getLocalizedDescription, getLocalizedGUIName, getName, setDescription, setDescription, setGUIName, setGUIName, setLocalizedDescription, setLocalizedGUIName, setName
 
Methods inherited from class org.mmbase.util.functions.FunctionProvider
addFunction, createParameters, getFunction, getFunctions, getFunctionValue, newFunctionInstance
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

state_up

boolean state_up
Javadoc:
Scope:
private

hits

int hits
Javadoc:
Scope:
private

miss

int miss
Javadoc:
Scope:
private

lines

LRUHashtable<Object,Object> lines
Javadoc:
Scope:
private
Constructor Detail

cache

public cache()
Simple file cache system that can be used by any servlet

Method Detail

onload

public void onload()
Description copied from class: Module
prepares the module when loaded. Onload must be overridden to execute methods that need to be performed when the module is loaded but before any other modules are initailized.
This method is called by Module.startModules(). You should not call onload() directly.

Overrides:
onload in class Module
Duplicate:

reload

public void reload()
Javadoc:

shutdown

public void shutdown()
Description copied from class: Module
Shuts down the module. This method is called by shutdownModules.

Overrides:
shutdown in class Module
Duplicate:

lines

public LRUHashtable<Object,Object> lines()
Old interface to the inner table, will be removed soon

Specified by:
lines in interface cacheInterface
Deprecated-now:
direct access to lines seems undesirable and is implementation-dependent

get

public cacheline get(Object wanted)
Try to get a cacheline from cache, returns null if not found

Specified by:
get in interface cacheInterface
Javadoc:

put

public cacheline put(Object key,
                     Object value)
Try to put a cacheline in cache, returns old one if available In all other cases returns null.

Specified by:
put in interface cacheInterface
Javadoc:

clear

public boolean clear()
Clear the whole cache in one go

Specified by:
clear in interface cacheInterface

remove

public cacheline remove(Object key)
Remove the entry identified by key from the cache

Specified by:
remove in interface cacheInterface
Javadoc:

init

public void init()
Description copied from class: Module
Initializes the module. Init must be overridden to read the environment variables it needs.
This method is called by Module.startModule(), which makes sure it is not called more than once. You should not call init() directly, call startModule() instead.

Specified by:
init in interface cacheInterface
Overrides:
init in class Module
Javadoc:

unload

public void unload()
Javadoc:

getStates

public Map<String,String> getStates()
Description copied from class: Module
Returns the module's runtime-generated state information as a unmodifiable map with name-value pairs.

Overrides:
getStates in class Module
Javadoc:

state

public Map<String,String> state()

readParams

void readParams()
Javadoc:

getModuleInfo

public String getModuleInfo()
Description copied from class: Module
Provide some info on the module; By default, this returns the module description for the default locale

Overrides:
getModuleInfo in class Module
Duplicate:
Should be handled with a standard method in Module that uses the configuration files.


MMBase 2.0-SNAPSHOT - null