org.openspaces.remoting.scripting.cache
Class LRUThreadSafeCompiledScriptCache
java.lang.Object
  
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
 
 
 
 
| Methods inherited from class java.lang.Object | 
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
 
DEFAULT_CACHE_SIZE
public static final int DEFAULT_CACHE_SIZE
- See Also:
 - Constant Field Values
 
LRUThreadSafeCompiledScriptCache
public LRUThreadSafeCompiledScriptCache()
LRUThreadSafeCompiledScriptCache
public LRUThreadSafeCompiledScriptCache(int cacheSize)
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
 
 
Copyright © GigaSpaces.