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 NashornSandboxes. The interface provides a facility to implement concurrent caches, but the actual thread safety is at the implementor's discretion.
  • Method Summary

    Modifier and Type
    Method
    Description
    getOrCreate(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

      String getOrCreate(String js, boolean allowNoBraces, Supplier<String> producer)
      Gets a value from the cache and tries to create it if it couldn't be found.
      Parameters:
      js - the raw javascript code
      allowNoBraces - 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.