Class LRUThreadSafeCompiledScriptCache
java.lang.Object
org.openspaces.remoting.scripting.cache.LRUThreadSafeCompiledScriptCache
- All Implemented Interfaces:
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
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionget(String name, LocalScriptExecutor executor, Script script) Gets the compiled script from the cache.voidput(String name, Object compiledScript, LocalScriptExecutor executor) Puts a compiled script back to the cache.
-
Field Details
-
DEFAULT_CACHE_SIZE
public static final int DEFAULT_CACHE_SIZE- See Also:
-
-
Constructor Details
-
LRUThreadSafeCompiledScriptCache
public LRUThreadSafeCompiledScriptCache() -
LRUThreadSafeCompiledScriptCache
public LRUThreadSafeCompiledScriptCache(int cacheSize)
-
-
Method Details
-
get
public Object get(String name, LocalScriptExecutor executor, Script script) throws ScriptCompilationException Description copied from interface:CompiledScriptCacheGets the compiled script from the cache. Compiles it if a new instance is needed using the provided local executor.- Specified by:
getin interfaceCompiledScriptCache- 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
Description copied from interface:CompiledScriptCachePuts a compiled script back to the cache.- Specified by:
putin interfaceCompiledScriptCache- 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
-