freemarker.template
Interface TemplateCache

All Known Implementing Classes:
FileTemplateCache

public interface TemplateCache

An interface for caches that store compiled templates. Note that a Template must be associated with an instance of TemplateCache for the <include...> mechanism to work.

Version:
$Id: TemplateCache.java,v 1.17 2002/04/30 13:29:23 revusky Exp $
See Also:
FileTemplateCache

Method Summary
 void clear()
          Clears the cache.
 Template getTemplate(java.lang.String name)
          Retrieves a template from the cache.
 Template getTemplate(java.lang.String name, java.util.Locale locale)
          Retrieves a template corresponding to the name and locale.
 Template getTemplate(java.lang.String name, java.util.Locale locale, java.lang.String encoding)
          Retrieves a template corresponding to the name and locale.
 Template getTemplate(java.lang.String name, java.lang.String encoding)
          retrieves a file of the given name with the given encoding.
 void outputRawFile(java.lang.String filename, java.lang.String encoding, java.io.Writer out)
          Simply outputs the given file from the cache without any template processing.
 

Method Detail

getTemplate

public Template getTemplate(java.lang.String name)
                     throws java.io.IOException
Retrieves a template from the cache. This method assumes defaults for the locale and character encoding.
Parameters:
name - a string uniquely identifying the template.
Returns:
the template, or null if not found.

getTemplate

public Template getTemplate(java.lang.String name,
                            java.util.Locale locale)
                     throws java.io.IOException
Retrieves a template corresponding to the name and locale. This method attempts to find a locale-specific version of the file based on the standard naming scheme, e.g. filename_en_US.html. The encoding is deduced from the locale.

getTemplate

public Template getTemplate(java.lang.String name,
                            java.lang.String encoding)
                     throws java.io.IOException
retrieves a file of the given name with the given encoding.

getTemplate

public Template getTemplate(java.lang.String name,
                            java.util.Locale locale,
                            java.lang.String encoding)
                     throws java.io.IOException
Retrieves a template corresponding to the name and locale. This method attempts to find a locale-specific version of the file based on the standard naming scheme, e.g. filename_fr_CA.html.

outputRawFile

public void outputRawFile(java.lang.String filename,
                          java.lang.String encoding,
                          java.io.Writer out)
                   throws java.io.IOException
Simply outputs the given file from the cache without any template processing. If the encoding is null, it uses a default encoding.

clear

public void clear()
Clears the cache.