Package delight.nashornsandbox
Interface SecuredJsCache
- All Known Implementing Classes:
LinkedHashMapSecuredJsCache
public interface SecuredJsCache
A cache used to store pre-processed javascript strings, which can be used to share
these among different
NashornSandbox
es. The interface provides a facility
to implement concurrent caches, but the actual thread safety is at
the implementor's discretion.-
Method Summary
Modifier and TypeMethodDescriptiongetOrCreate
(String js, boolean allowNoBraces, Supplier<String> producer) Gets a value from the cache and tries to create it if it couldn't be found.
-
Method Details
-
getOrCreate
Gets a value from the cache and tries to create it if it couldn't be found.- Parameters:
js
- the raw javascript codeallowNoBraces
- whether missing braces are allowed.producer
- if no cached value could be found, this is used to create the value- Returns:
- the cached or created value, or null if it could be neither found in the cache nor created.
-