Class BroadleafThymeleaf3CacheProcessor

java.lang.Object
org.thymeleaf.processor.AbstractProcessor
org.thymeleaf.processor.element.AbstractElementModelProcessor
org.thymeleaf.processor.element.AbstractAttributeModelProcessor
org.broadleafcommerce.presentation.thymeleaf3.processor.BroadleafThymeleaf3CacheProcessor
All Implemented Interfaces:
org.thymeleaf.processor.element.IElementModelProcessor, org.thymeleaf.processor.element.IElementProcessor, org.thymeleaf.processor.IProcessor

public class BroadleafThymeleaf3CacheProcessor extends org.thymeleaf.processor.element.AbstractAttributeModelProcessor
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
     
    protected javax.cache.Cache
     
    protected org.broadleafcommerce.presentation.cache.service.TemplateCacheKeyResolverService
     
    protected org.broadleafcommerce.common.extensibility.cache.JCacheUtil
     
    protected org.broadleafcommerce.common.config.service.SystemPropertiesService
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    addToCache(String cacheKey, org.thymeleaf.model.IModel model, org.thymeleaf.context.ITemplateContext context, Map<String,String> tagAttributes)
     
    protected Object
    checkCacheForElement(Map<String,String> tagAttributes, String cacheKey)
    If this template was found in cache, adds the response to the element and returns true.
    protected void
    doProcess(org.thymeleaf.context.ITemplateContext iContext, org.thymeleaf.model.IModel model, org.thymeleaf.engine.AttributeName attributeName, String attributeValue, org.thymeleaf.processor.element.IElementModelStructureHandler structureHandler)
     
    javax.cache.Cache
     
    boolean
     
    protected void
    replaceTagWithCache(String cachedObject, org.thymeleaf.model.IModel model, org.thymeleaf.context.ITemplateContext context)
     
    void
    setCache(javax.cache.Cache cache)
     
    protected boolean
    shouldCache(String attributeValue, org.broadleafcommerce.presentation.model.BroadleafTemplateContext context)
     

    Methods inherited from class org.thymeleaf.processor.element.AbstractAttributeModelProcessor

    doProcess

    Methods inherited from class org.thymeleaf.processor.element.AbstractElementModelProcessor

    getDialectPrefix, getMatchingAttributeName, getMatchingElementName, process

    Methods inherited from class org.thymeleaf.processor.AbstractProcessor

    getPrecedence, getTemplateMode

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.thymeleaf.processor.IProcessor

    getPrecedence, getTemplateMode
  • Field Details

    • ATTR_NAME

      public static final String ATTR_NAME
      See Also:
    • cache

      protected javax.cache.Cache cache
    • systemPropertiesService

      protected org.broadleafcommerce.common.config.service.SystemPropertiesService systemPropertiesService
    • cacheKeyResolver

      protected org.broadleafcommerce.presentation.cache.service.TemplateCacheKeyResolverService cacheKeyResolver
    • jcacheUtil

      protected org.broadleafcommerce.common.extensibility.cache.JCacheUtil jcacheUtil
  • Constructor Details

    • BroadleafThymeleaf3CacheProcessor

      public BroadleafThymeleaf3CacheProcessor()
  • Method Details

    • doProcess

      protected void doProcess(org.thymeleaf.context.ITemplateContext iContext, org.thymeleaf.model.IModel model, org.thymeleaf.engine.AttributeName attributeName, String attributeValue, org.thymeleaf.processor.element.IElementModelStructureHandler structureHandler)
      Specified by:
      doProcess in class org.thymeleaf.processor.element.AbstractAttributeModelProcessor
    • shouldCache

      protected boolean shouldCache(String attributeValue, org.broadleafcommerce.presentation.model.BroadleafTemplateContext context)
    • checkCacheForElement

      protected Object checkCacheForElement(Map<String,String> tagAttributes, String cacheKey)
      If this template was found in cache, adds the response to the element and returns true.

      If not found in cache, adds the cacheKey to the element so that the Writer can cache after the first process.

      Parameters:
      tagAttributes -
      cacheKey -
      Returns:
    • replaceTagWithCache

      protected void replaceTagWithCache(String cachedObject, org.thymeleaf.model.IModel model, org.thymeleaf.context.ITemplateContext context)
    • addToCache

      protected void addToCache(String cacheKey, org.thymeleaf.model.IModel model, org.thymeleaf.context.ITemplateContext context, Map<String,String> tagAttributes)
    • getCache

      public javax.cache.Cache getCache()
    • setCache

      public void setCache(javax.cache.Cache cache)
    • isCachingEnabled

      public boolean isCachingEnabled()