Package com.helger.photon.app.resource
Class WebSiteResourceCache
java.lang.Object
com.helger.photon.app.resource.WebSiteResourceCache
A global cache for
WebSiteResource objects, to avoid the hash
calculation over and over again.- Author:
- Philip Helger
-
Method Summary
Modifier and TypeMethodDescriptionstatic com.helger.commons.state.EChangeRemove all items contained in the cache.static WebSiteResourcegetOrCreateResource(EWebSiteResourceType eResourceType, String sPath, Charset aCharset) static booleanstatic booleanstatic com.helger.commons.state.EChangeremoveFromCache(EWebSiteResourceType eType, String sPath) static voidsetCacheEnabled(boolean bCacheEnabled) Globally enabled or disable the cache.static booleansetSilentMode(boolean bSilentMode) Enable or disable certain regular log messages.
-
Method Details
-
isSilentMode
public static boolean isSilentMode()- Returns:
trueif logging is disabled,falseif it is enabled.
-
setSilentMode
public static boolean setSilentMode(boolean bSilentMode) Enable or disable certain regular log messages.- Parameters:
bSilentMode-trueto disable logging,falseto enable logging- Returns:
- The previous value of the silent mode.
-
isCacheEnabled
public static boolean isCacheEnabled()- Returns:
trueif the cache is globally enabled,falseif the cache is disabled.
-
setCacheEnabled
public static void setCacheEnabled(boolean bCacheEnabled) Globally enabled or disable the cache.- Parameters:
bCacheEnabled-trueto enable it,falseto disable it.
-
getOrCreateResource
@Nonnull public static WebSiteResource getOrCreateResource(@Nonnull EWebSiteResourceType eResourceType, @Nonnull @Nonempty String sPath, @Nonnull Charset aCharset) -
removeFromCache
@Nonnull public static com.helger.commons.state.EChange removeFromCache(@Nonnull EWebSiteResourceType eType, @Nonnull @Nonempty String sPath) -
clearCache
Remove all items contained in the cache.- Returns:
EChange
-