Class ResourceCache

java.lang.Object
com.sun.faces.application.resource.ResourceCache

public class ResourceCache extends Object

This is the caching mechanism for caching ResourceInfo instances to offset the cost of looking up the resource.

This cache uses a background thread to check for modifications to the underlying webapp or JAR files containing resources. This check is periodic, configurable via context init param com.sun.faces.resourceUpdateCheckPeriod. Through this config option, the cache can also be made static or completely disabled. If the value of of this option is 0, then no check will be made making the cache static. If value of this option is less than 0, then no caching will be perfomed. Otherwise, the value of the option will be the number of minutes between modification checks.

  • Constructor Details

    • ResourceCache

      public ResourceCache()
      Constructs a new ResourceCache.
  • Method Details

    • add

      public ResourceInfo add(ResourceInfo info, List<String> contracts)
      Add the ResourceInfo to the internal cache.
      Parameters:
      info - resource metadata
      contracts - the contracts
      Returns:
      previous value associated with specified key, or null if there was no mapping for key
    • get

      public ResourceInfo get(String name, String libraryName, String localePrefix, List<String> contracts)
      Parameters:
      name - the resource name
      libraryName - the library name
      localePrefix - the locale prefix
      contracts - the contracts
      Returns:
      the ResourceInfo associated with key if any.
    • clear

      public void clear()

      Empty the cache.