Class WebSiteResourceCache

java.lang.Object
com.helger.photon.app.resource.WebSiteResourceCache

@ThreadSafe public final class WebSiteResourceCache extends Object
A global cache for WebSiteResource objects, to avoid the hash calculation over and over again.
Author:
Philip Helger
  • Method Details

    • 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