Class DataTrackingKeyGen


  • public final class DataTrackingKeyGen
    extends Object
    Factory class for generating Spring Cache KeyGenerator instances that fulfill common Broadleaf use cases. These are useful, as they include additional key fragments, such as tenant and locale related information that are not obvious from cached method signatures.
    Author:
    Jeff Fischer
    • Method Detail

      • ofCatalogWithVendorSupport

        public static com.broadleafcommerce.common.extension.cache.key.ContextKeyGen ofCatalogWithVendorSupport​(DataTrackingKeyGen.KeyType keyType,
                                                                                                                @Nullable
                                                                                                                VendorAwareTrackablePolicyUtils vendorAwareTrackablePolicyUtils)
        When vendor processing is enabled, catalog-discriminated entities are also discriminated by the vendor their catalog is associated to. Cache key generation must incorporate the current authentication's vendor restrictions and current policy requirements to account for this, so this creates key generators that also consider the requisite vendor data.
        Parameters:
        keyType - a catalog-related DataTrackingKeyGen.KeyType
        vendorAwareTrackablePolicyUtils - (optional) the vendor-aware trackable policy utils implementation used to determine the current authentication's privileges. May be null in the event vendor processing is disabled or if policy validation is disabled. If null, no vendor privilege considerations will be added to the key.
        Returns:
        a key generator incorporating catalog information from context info method arguments and vendor privileges
        Throws:
        IllegalArgumentException - if the key type is not a catalog type
        See Also:
        CatalogVendorAwareCacheKeyEnhancer