GigaSpaces XAP 9.7.2 API

org.openspaces.remoting.scripting.cache
Class LRUThreadSafeCompiledScriptCache

java.lang.Object
  extended by org.openspaces.remoting.scripting.cache.LRUThreadSafeCompiledScriptCache
All Implemented Interfaces:
CompiledScriptCache

public class LRUThreadSafeCompiledScriptCache
extends Object
implements CompiledScriptCache

An LRU cache that can handle compiled scripts that are thread safe. Thread safe compiled scripts are scripts that can be executed by several threads at the same time.

Uses a simple LinkedHashMap to implement the LRU.

Author:
kimchy

Field Summary
static int DEFAULT_CACHE_SIZE
           
 
Constructor Summary
LRUThreadSafeCompiledScriptCache()
           
LRUThreadSafeCompiledScriptCache(int cacheSize)
           
 
Method Summary
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_CACHE_SIZE

public static final int DEFAULT_CACHE_SIZE
See Also:
Constant Field Values
Constructor Detail

LRUThreadSafeCompiledScriptCache

public LRUThreadSafeCompiledScriptCache()

LRUThreadSafeCompiledScriptCache

public LRUThreadSafeCompiledScriptCache(int cacheSize)
Method Detail

get

public Object get(String name,
                  LocalScriptExecutor executor,
                  Script script)
           throws ScriptCompilationException
Description copied from interface: CompiledScriptCache
Gets the compiled script from the cache. Compiles it if a new instance is needed using the provided local executor.

Specified by:
get in interface CompiledScriptCache
Parameters:
name - The name (key) in the cache.
executor - The executor to use to compile the script.
script - The script to compile
Returns:
A compiled script from the cache
Throws:
ScriptCompilationException

put

public void put(String name,
                Object compiledScript,
                LocalScriptExecutor executor)
Description copied from interface: CompiledScriptCache
Puts a compiled script back to the cache.

Specified by:
put in interface CompiledScriptCache
Parameters:
name - 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 cache

GigaSpaces XAP 9.7.2 API

Copyright © GigaSpaces.