Package com.helger.photon.app.resource
Class WebSiteResourceCache
- java.lang.Object
-
- com.helger.photon.app.resource.WebSiteResourceCache
-
@ThreadSafe public final class WebSiteResourceCache extends Object
A global cache forWebSiteResource
objects, to avoid the hash calculation over and over again.- Author:
- Philip Helger
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static com.helger.commons.state.EChange
clearCache()
Remove all items contained in the cache.static WebSiteResource
getOrCreateResource(EWebSiteResourceType eResourceType, String sPath, Charset aCharset)
static boolean
isCacheEnabled()
static boolean
isSilentMode()
static com.helger.commons.state.EChange
removeFromCache(EWebSiteResourceType eType, String sPath)
static void
setCacheEnabled(boolean bCacheEnabled)
Globally enabled or disable the cache.static boolean
setSilentMode(boolean bSilentMode)
Enable or disable certain regular log messages.
-
-
-
Method Detail
-
isSilentMode
public static boolean isSilentMode()
- Returns:
true
if logging is disabled,false
if it is enabled.
-
setSilentMode
public static boolean setSilentMode(boolean bSilentMode)
Enable or disable certain regular log messages.- Parameters:
bSilentMode
-true
to disable logging,false
to enable logging- Returns:
- The previous value of the silent mode.
-
isCacheEnabled
public static boolean isCacheEnabled()
- Returns:
true
if the cache is globally enabled,false
if the cache is disabled.
-
setCacheEnabled
public static void setCacheEnabled(boolean bCacheEnabled)
Globally enabled or disable the cache.- Parameters:
bCacheEnabled
-true
to enable it,false
to 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
@Nonnull public static com.helger.commons.state.EChange clearCache()
Remove all items contained in the cache.- Returns:
EChange
-
-