pnuts.ext
Class CachedPnutsImpl

java.lang.Object
  |
  +--pnuts.lang.PnutsImpl
        |
        +--pnuts.compiler.CompilerPnutsImpl
              |
              +--pnuts.ext.CachedPnutsImpl

public class CachedPnutsImpl
extends CompilerPnutsImpl

PnutsImpl which caches parsed (compiled) scripts and reuse them. This class is useful when same scripts are executed over and over, e.g. servlet scripts.

See Also:
PnutsImpl, CompilerPnutsImpl

Constructor Summary
CachedPnutsImpl()
           
CachedPnutsImpl(boolean useCompiler)
           
 
Method Summary
 java.lang.Object eval(java.lang.String expr, Context context)
          Evaluate an expression
 java.lang.Object load(java.net.URL scriptURL, Context context)
          Load a script file from a URL
 void reset()
          Reset the cache entries
 
Methods inherited from class pnuts.compiler.CompilerPnutsImpl
accept, includeLineNo
 
Methods inherited from class pnuts.lang.PnutsImpl
checkException, load, load, loadFile, popFile, pushFile
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CachedPnutsImpl

public CachedPnutsImpl()

CachedPnutsImpl

public CachedPnutsImpl(boolean useCompiler)
Parameters:
useCompiler - true if compiler is used (default)
Method Detail

reset

public void reset()
Reset the cache entries

eval

public java.lang.Object eval(java.lang.String expr,
                             Context context)
Evaluate an expression
Overrides:
eval in class PnutsImpl
Parameters:
expr - the expression to be evaluated
context - the context in which the expression is evaluated
See Also:
Pnuts.eval(String, pnuts.lang.Context)

load

public java.lang.Object load(java.net.URL scriptURL,
                             Context context)
Load a script file from a URL
Overrides:
load in class PnutsImpl
Parameters:
scriptURL - the URL of the script
context - the context in which the script is executed