public class StylesheetCache extends GeneratingCache
| Modifier and Type | Class and Description |
|---|---|
private static class |
StylesheetCache.DepResolver
While loading a stylesheet, we record all the sub-stylesheets
referenced by it, so that we can form a list of all the dependencies.
|
static interface |
StylesheetCache.TraceListenerFactory |
Cache.ListEntry, Cache.NullIterator| Modifier and Type | Field and Description |
|---|---|
private boolean |
dependencyChecking |
private GeneratingCache |
dependencyReceiver |
private TransformerFactory |
factory |
private StylesheetCache.TraceListenerFactory |
traceListenerFactory |
| Constructor and Description |
|---|
StylesheetCache(int maxEntries,
int maxTime,
boolean dependencyChecking)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
enableProfiling(StylesheetCache.TraceListenerFactory tlf)
Enable or disable profiling (only affects stylesheets that are
not already cached).
|
Templates |
find(String path)
Locate the stylesheet for the given filesystem path.
|
protected Object |
generate(Object key)
Load and parse a stylesheet from the filesystem.
|
protected void |
logAction(String action,
Object key,
Object value)
Prints out useful debugging info
|
addDependency, findcleanup, clear, dependenciesValid, getDependencies, has, lastSet, remove, sizeprivate boolean dependencyChecking
private GeneratingCache dependencyReceiver
private StylesheetCache.TraceListenerFactory traceListenerFactory
private TransformerFactory factory
public StylesheetCache(int maxEntries,
int maxTime,
boolean dependencyChecking)
maxEntries - Max # of entries before old ones are flushedmaxTime - Max age (in seconds) before an entry is flushed.dependencyChecking - Whether to keep track of dependencies and
invalidate cache entries when dependents
are updated.public Templates find(String path)
throws Exception
path - Filesystem path of the stylesheet to loadException - If the stylesheet could not be loaded.public void enableProfiling(StylesheetCache.TraceListenerFactory tlf)
protected Object generate(Object key)
throws Exception
generate in class GeneratingCachekey - (String)Filesystem path of the stylesheet to loadException - If the stylesheet could not be loaded.