Package org.apache.sling.scripting.api
Interface ScriptCache
-
public interface ScriptCacheTheScriptCacheservice interface defines a cache for compiled scripts. Implementations of this interface should be thread-safe.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidclear()Empties the cache.CachedScriptgetScript(java.lang.String scriptPath)Retrieves theCachedScriptcorresponding to the script accessible from thescriptPath.voidputScript(CachedScript script)Stores aCachedScriptin the cache.booleanremoveScript(java.lang.String scriptPath)Removes the script identified byscriptPathfrom the cache.
-
-
-
Method Detail
-
getScript
CachedScript getScript(java.lang.String scriptPath)
Retrieves theCachedScriptcorresponding to the script accessible from thescriptPath.- Parameters:
scriptPath- the path from where the script can be accessed- Returns:
- the
CachedScriptif one exists,nullotherwise
-
putScript
void putScript(CachedScript script)
Stores aCachedScriptin the cache. If a previous version of it exist in the cache it is overridden.- Parameters:
script- theCachedScriptthat should be stored in the cache
-
clear
void clear()
Empties the cache.
-
removeScript
boolean removeScript(java.lang.String scriptPath)
Removes the script identified byscriptPathfrom the cache.- Parameters:
scriptPath- the path from where the script can be accessed- Returns:
trueif a script was cached from that path and was removed,falseotherwise
-
-