Class SparseTranslationOverrideStrategy

java.lang.Object
org.broadleafcommerce.common.i18n.service.SparseTranslationOverrideStrategy
All Implemented Interfaces:
OverridePreCacheInitializer, TranslationOverrideStrategy, org.springframework.core.Ordered

@Component("blSparseTranslationOverrideStrategy") public class SparseTranslationOverrideStrategy extends Object implements TranslationOverrideStrategy, OverridePreCacheInitializer
A retrieval and caching strategy for translations. Primarily supports multitenant scenarios with the following characteristics:
  • A very large template translation 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 ThresholdCacheTranslationOverrideStrategy, this strategy opts for completely caching overrides and minimizing template queries. The highest template query optimization is achieved in conjunction with the 'precached.sparse.override.template.search.restrict.catalog' property set to true (false by default). See com.broadleafcommerce.tenant.service.extension.MultiTenantTemplateOnlyQueryExtensionHandler for more information, since this setting assumes the translated entity is in the same catalog as the Translation instance, which may not be true for all installations.

Hybrid configurations are also possible for small to medium size template translation 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 ThresholdCacheTranslationOverrideStrategy. 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: