Class BroadleafThymeleaf3ICache<K,V>

java.lang.Object
org.broadleafcommerce.presentation.thymeleaf3.cache.BroadleafThymeleaf3ICache<K,V>
All Implemented Interfaces:
org.thymeleaf.cache.ICache<K,V>

public class BroadleafThymeleaf3ICache<K,V> extends Object implements org.thymeleaf.cache.ICache<K,V>
Modification of StandardCache in order for BLC to be able to handle caching based on site and profile level templates. As StandardCache is declared final, this is a wholesale copy with a few changes to get(), put() and getValueIfStillValid().
Author:
Chad Harchar (charchar)
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected org.broadleafcommerce.common.web.cache.BLCICacheExtensionManager
     
    static final String
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    BroadleafThymeleaf3ICache(String name, boolean useSoftReferences, int initialCapacity, int maxSize, org.thymeleaf.cache.ICacheEntryValidityChecker<? super K,? super V> entryValidityChecker, org.slf4j.Logger logger, org.broadleafcommerce.common.web.cache.BLCICacheExtensionManager extensionManager)
    The only difference from StandardCache() is the constructor name
  • Method Summary

    Modifier and Type
    Method
    Description
    void
     
    void
    clearKey(K key)
     
    This method behaves the same as StandardCache.get()
    void
    defaultPut(K key, V value)
    This method behaves the same as StandardCache.put()
    get(K key)
    This method differs from StandardCache.get() by not caching if we're in a sandbox, and adding a hook for Site and Profile interactions
    get(K key, org.thymeleaf.cache.ICacheEntryValidityChecker<? super K,? super V> validityChecker)
     
    int
     
     
    boolean
     
    boolean
     
    protected void
     
    Returns all the keys contained in this cache.
    protected void
     
    void
    put(K key, V value)
    This method differs from StandardCache.put() by not caching if we're in a sandbox, and adding a hook for Site and Profile interactions
    int
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • NOT_FOUND

      public static final String NOT_FOUND
      See Also:
    • extensionManager

      protected org.broadleafcommerce.common.web.cache.BLCICacheExtensionManager extensionManager
  • Constructor Details

    • BroadleafThymeleaf3ICache

      public BroadleafThymeleaf3ICache(String name, boolean useSoftReferences, int initialCapacity, int maxSize, org.thymeleaf.cache.ICacheEntryValidityChecker<? super K,? super V> entryValidityChecker, org.slf4j.Logger logger, org.broadleafcommerce.common.web.cache.BLCICacheExtensionManager extensionManager)
      The only difference from StandardCache() is the constructor name
      Parameters:
      name -
      useSoftReferences -
      initialCapacity -
      maxSize -
      entryValidityChecker -
      logger -
      extensionManager -
  • Method Details

    • put

      public void put(K key, V value)
      This method differs from StandardCache.put() by not caching if we're in a sandbox, and adding a hook for Site and Profile interactions
      Specified by:
      put in interface org.thymeleaf.cache.ICache<K,V>
      Parameters:
      key -
      value -
    • get

      public V get(K key)
      This method differs from StandardCache.get() by not caching if we're in a sandbox, and adding a hook for Site and Profile interactions
      Specified by:
      get in interface org.thymeleaf.cache.ICache<K,V>
      Parameters:
      key -
      Returns:
    • defaultPut

      public void defaultPut(K key, V value)
      This method behaves the same as StandardCache.put()
      Parameters:
      key -
      value -
    • defaultGet

      public V defaultGet(K key)
      This method behaves the same as StandardCache.get()
      Parameters:
      key -
      Returns:
    • get

      public V get(K key, org.thymeleaf.cache.ICacheEntryValidityChecker<? super K,? super V> validityChecker)
      Specified by:
      get in interface org.thymeleaf.cache.ICache<K,V>
    • keySet

      public Set<K> keySet()

      Returns all the keys contained in this cache. Note this method might return keys for entries that are already invalid, so the result of calling get(Object) for these keys might be null.

      Specified by:
      keySet in interface org.thymeleaf.cache.ICache<K,V>
      Returns:
      the complete set of cache keys. Might include keys for already-invalid (non-cleaned) entries.
      Since:
      2.1.4
    • clear

      public void clear()
      Specified by:
      clear in interface org.thymeleaf.cache.ICache<K,V>
    • clearKey

      public void clearKey(K key)
      Specified by:
      clearKey in interface org.thymeleaf.cache.ICache<K,V>
    • getName

      public String getName()
    • hasMaxSize

      public boolean hasMaxSize()
    • getMaxSize

      public int getMaxSize()
    • getUseSoftReferences

      public boolean getUseSoftReferences()
    • size

      public int size()
    • incrementReportEntity

      protected void incrementReportEntity(AtomicLong entity)
    • outputReportIfNeeded

      protected void outputReportIfNeeded()