org.mmbase.cache.xslt
Class TemplateCache

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

public class TemplateCache
extends Cache

A cache for XSL transformation templates. A template can be based on a file, or on a string. In the first case the cache key is based on the file name, and the cache entry is invalidated if the file changes (so, if you uses 'imports' in the XSL template, you have to touch the file which imports, if the imported files changes). If the template is based on a string, then the string itself serves as a key.

Since:
MMBase-1.6
Version:
$Id: TemplateCache.java,v 1.15 2006/02/13 18:02:35 michiel Exp $
Author:
Michiel Meeuwissen

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
static TemplateCache getCache()
          Returns the Template cache.
 String getDescription()
          Gives a description for this cache type.
 String getName()
          Returns a name for this cache type.
 Templates getTemplates(Source src)
           
 Templates getTemplates(Source src, URIResolver uri)
           
static void main(String[] argv)
          Invocation of the class from the commandline for testing
 Object put(Object key, Object value)
          You can only put Source/Templates values in the cache, so this throws an Exception.
 Object put(Source src, Templates value)
           
 Object put(Source src, Templates value, URIResolver uri)
           
 Object remove(Object key)
          When removing an entry (because of LRU e.g), then also the FileWatcher must be removed.
 
Methods inherited from class org.mmbase.cache.Cache
checkCachePolicy, clear, contains, containsKey, containsValue, entrySet, equals, get, getByteSize, getByteSize, getCache, getCaches, getCheapByteSize, getCount, getDefaultMaxEntrySize, getHits, getMaxEntrySize, getMisses, getPuts, getRatio, getStats, getTotalByteSize, hashCode, isActive, isEmpty, keySet, maxSize, putAll, putCache, putCache, setActive, setMaxSize, size, toString, values
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

getCache

public static TemplateCache getCache()
Returns the Template 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

getTemplates

public Templates getTemplates(Source src)

getTemplates

public Templates getTemplates(Source src,
                              URIResolver uri)

remove

public Object remove(Object key)
When removing an entry (because of LRU e.g), then also the FileWatcher must be removed.

Specified by:
remove in interface Map
Overrides:
remove in class Cache
See Also:
Map.remove(java.lang.Object)

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

put

public Object put(Source src,
                  Templates value)

put

public Object put(Source src,
                  Templates value,
                  URIResolver uri)

main

public static void main(String[] argv)
Invocation of the class from the commandline for testing



MMBase build 1.8.1.20060716