org.mmbase.cache.xslt
Class ResultCache

java.lang.Object
  extended by org.mmbase.cache.Cache<String,String>
      extended by org.mmbase.cache.xslt.ResultCache
All Implemented Interfaces:
Map<String,String>, CacheMBean, SizeMeasurable

public class ResultCache
extends Cache<String,String>

Caches the results of XSL transformations.

Since:
MMBase-1.6
Version:
$Id: ResultCache.java 35968 2009-06-11 06:57:52Z michiel $
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/interfaces inherited from interface java.util.Map
Map.Entry<K,V>
 
Field Summary
 
Fields inherited from class org.mmbase.cache.Cache
lock, 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.
 String put(Object key, Templates 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, getAvarageValueLength, getByteSize, getByteSize, getCheapByteSize, getCount, getHits, getImplementation, getLock, getMaxEntrySize, getMaxSize, getMisses, getPuts, getRatio, getSize, getStats, hashCode, isActive, isEmpty, keySet, maxSize, put, putAll, putCache, remove, reset, setActive, setMaxEntrySize, 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<String,String>

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.

Specified by:
getName in interface CacheMBean
Overrides:
getName in class Cache<String,String>

getDescription

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

Specified by:
getDescription in interface CacheMBean
Overrides:
getDescription in class Cache<String,String>

put

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

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 2.0-SNAPSHOT - null