Class SparseInternationalMessageOverrideStrategy

java.lang.Object
com.broadleafcommerce.i18n.enterprise.config.service.SparseInternationalMessageOverrideStrategy
All Implemented Interfaces:
InternationalMessageOverrideStrategy, org.broadleafcommerce.common.cache.OverridePreCacheInitializer, org.springframework.core.Ordered

@Component("blSparseInternationalMessageOverrideStrategy") public class SparseInternationalMessageOverrideStrategy extends Object implements InternationalMessageOverrideStrategy, org.broadleafcommerce.common.cache.OverridePreCacheInitializer
A retrieval and caching strategy for international messages. Primarily supports multitenant scenarios with the following characteristics:
  • A very large template message catalog
  • A small number of standard site overrides
  • Small or large quantity of individual standard sites
Since the large catalog can be costly for the threshold count bounding inherent to ThresholdCacheInternationalMessageOverrideStrategy, this strategy opts for completely caching overrides and minimizing template queries.

Hybrid configurations are also possible for small to medium size template message catalogs where the threshold count bounding queries are not a concern and complete (or partial) caching of the template catalog can be achieved. However, such a strategy may provide little to no benefit over the out-of-the-box ThresholdCacheInternationalMessageOverrideStrategy. See the templateEnabled property for more information.

This strategy also works best when there are few standard sites with isolated values (i.e. the value was created in the standard site and was not inherited from a profile or catalog). This is because the strategy can utilize an optimized template query that is portable across sites if it doesn't have to take into account the standard site. The strategy uses OverridePreCacheService.isActiveIsolatedSiteForType(Long, String) to figure out this state.

This strategy is disabled by default. Please see the javadoc for com.broadleafcommerce.tenant.service.cache.SparseOverridePreCacheServiceImpl (MultiTenant only) for more information on how to enable this strategy via configuration of that service.
Author:
Jeff Fischer
See Also:
  • Field Details

    • PRECACHED_SPARSE_OVERRIDE_ORDER

      public static final int PRECACHED_SPARSE_OVERRIDE_ORDER
      See Also:
    • preCachedSparseOverrideService

      protected org.broadleafcommerce.common.cache.OverridePreCacheService preCachedSparseOverrideService
    • extensionManager

      protected org.broadleafcommerce.common.extension.TemplateOnlyQueryExtensionManager extensionManager
    • em

      protected jakarta.persistence.EntityManager em
    • dao

      protected InternationalMessageDao dao
    • templateEnabled

      @Value("${precached.sparse.override.internationalmessage.template.enabled:true}") protected boolean templateEnabled
      Whether or not getLocaleBasedTemplateValue(String, String, String, String, String, String) will be utilized from this strategy. If false, the fallback ThresholdCacheInternationalMessageOverrideStrategy.getLocaleBasedTemplateValue(String, String, String, String, String, String) will be used instead.

      If the 'template' repository (MT concept) is large, this value should be left true. However, if the 'template' repository is relatively small, you may want to consider setting this to false in order to leverage the possibility of complete caching in the default strategy. See InternationalMessageSupport.getThresholdForFullCache() for more info on this option.

      The default value is true. Set the 'precached.sparse.override.internationalmessage.template.enabled' property to change the value.

      This value is meaningless if the current standard site is found to contain active isolated values for international messages. Review the documentation in com.broadleafcommerce.tenant.service.cache.SparseOverridePreCacheServiceImpl for more information.
  • Constructor Details

    • SparseInternationalMessageOverrideStrategy

      public SparseInternationalMessageOverrideStrategy()
  • Method Details