org.mmbase.cache.xslt
Class ResultCache

java.lang.Object
  extended byorg.mmbase.cache.Cache
      extended byorg.mmbase.cache.xslt.ResultCache
All Implemented Interfaces:
Map, SizeMeasurable

public class ResultCache
extends Cache

Caches the results of XSL transformations.

Since:
MMBase-1.6
Version:
$Id: ResultCache.java,v 1.9 2005/01/30 16:46:38 nico Exp $
Author:
Michiel Meeuwissen
To Do:
Cache entries must be invalidated if XSL template changes (now getSystemId is used as cache entry). See TemplatesCache (which uses a FileWatcher).

Nested Class Summary
 
Nested classes inherited from class java.util.Map
Map.Entry
 
Field Summary
 
Fields inherited from class org.mmbase.cache.Cache
maxEntrySize
 
Method Summary
 String get(Templates temp, Source xsl, Map params, Properties props, Document src)
          This is an intelligent get, which also does the put if it cannot find the requested result.
static ResultCache getCache()
          Returns the XSLT Result cache.
protected  int getDefaultMaxEntrySize()
          This has to be overridden by Caches which support max entry size.
 String getDescription()
          Gives a description for this cache type.
 String getName()
          Returns a name for this cache type.
 Object put(Object key, Object value)
          You can only put Source/Templates values in the cache, so this throws an Exception.
 
Methods inherited from class org.mmbase.cache.Cache
checkCachePolicy, clear, contains, containsKey, containsValue, entrySet, equals, get, getByteSize, getByteSize, getCache, getCaches, getCheapByteSize, getCount, getHits, getMaxEntrySize, getMisses, getPuts, getRatio, getStats, getTotalByteSize, hashCode, isActive, isEmpty, keySet, main, maxSize, putAll, putCache, putCache, remove, setActive, setMaxSize, size, toString, values
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

getDefaultMaxEntrySize

protected int getDefaultMaxEntrySize()
Description copied from class: Cache
This has to be overridden by Caches which support max entry size.

Overrides:
getDefaultMaxEntrySize in class Cache

getCache

public static ResultCache getCache()
Returns the XSLT Result cache.


getName

public String getName()
Description copied from class: Cache
Returns a name for this cache type. Default it is the class name, but this normally will be overriden.

Overrides:
getName in class Cache

getDescription

public String getDescription()
Description copied from class: Cache
Gives a description for this cache type. This can be used in cache overviews.

Overrides:
getDescription in class Cache

put

public Object put(Object key,
                  Object value)
You can only put Source/Templates values in the cache, so this throws an Exception.

Specified by:
put in interface Map
Overrides:
put in class Cache
Throws:
RuntimeException

get

public String get(Templates temp,
                  Source xsl,
                  Map params,
                  Properties props,
                  Document src)
This is an intelligent get, which also does the put if it cannot find the requested result. So, it never returns null.

Parameters:
temp - The Templates from which the transformer must be created (if necessary)
xsl - The XSL Source. This only used to produce the key, because with the Templates it is difficult
params - Parameters for the XSL Transformation
src - The Document which must be transformed.
Returns:
The transformation result. It does not return null.


MMBase build 1.8.1.20060716