public class LRUNonThreadSafeCompiledScriptCache extends Object implements CompiledScriptCache
The cache holds a CompiledScriptPool per
script name, and allocates a pool when a new one is required. The pool allows to get and put
compiled scripts.
Uses a simple LinkedHashMap to implement the LRU.
| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_CACHE_SIZE |
| Constructor and Description |
|---|
LRUNonThreadSafeCompiledScriptCache() |
LRUNonThreadSafeCompiledScriptCache(int cacheSize) |
LRUNonThreadSafeCompiledScriptCache(int cacheSize,
CompiledScriptPoolFactory compiledScriptPoolFactory) |
| Modifier and Type | Method and Description |
|---|---|
Object |
get(String name,
LocalScriptExecutor executor,
Script script)
Gets the compiled script from the cache.
|
void |
put(String name,
Object compiledScript,
LocalScriptExecutor executor)
Puts a compiled script back to the cache.
|
public static final int DEFAULT_CACHE_SIZE
public LRUNonThreadSafeCompiledScriptCache()
public LRUNonThreadSafeCompiledScriptCache(int cacheSize)
public LRUNonThreadSafeCompiledScriptCache(int cacheSize,
CompiledScriptPoolFactory compiledScriptPoolFactory)
public Object get(String name, LocalScriptExecutor executor, Script script) throws ScriptCompilationException
CompiledScriptCacheget in interface CompiledScriptCachename - The name (key) in the cache.executor - The executor to use to compile the script.script - The script to compileScriptCompilationExceptionpublic void put(String name, Object compiledScript, LocalScriptExecutor executor)
CompiledScriptCacheput in interface CompiledScriptCachename - The name (key) in the cache)compiledScript - The compiled script to put back in the cache.executor - The executor to use in order to close any evicted compiled scripts from
the cacheCopyright © GigaSpaces.