FileDocCategorySizeDatePackage
ResultCache.javaAPI DocExample3519Sun Sep 02 14:59:04 BST 2001com.oreilly.javaxslt.util

ResultCache

public class ResultCache extends Object
A utility class that caches XSLT transformation results in memory.
author
Eric M. Burke

Fields Summary
private static Map
cache
Constructors Summary
private ResultCache()

    
Methods Summary
public static synchronized voidflushAll()
Flush all results from memory, emptying the cache.


                 
         
        cache.clear();
    
public static synchronized java.lang.Stringtransform(java.lang.String xmlFileName, java.lang.String xsltFileName)
Perform a single XSLT transformation.


        MapKey key = new MapKey(xmlFileName, xsltFileName);

        File xmlFile = new File(xmlFileName);
        File xsltFile = new File(xsltFileName);

        MapValue value = (MapValue) cache.get(key);
        if (value == null || value.isDirty(xmlFile, xsltFile)) {
            // this step performs the transformation
            value = new MapValue(xmlFile, xsltFile);
            cache.put(key, value);
        }

        return value.result;