Broadleaf Microservices
  • v1.0.0-latest-prod

Caching Offers

Introduction

Caching mechanisms have been introduced and fine-tuned within OfferServices to reduce the load on the database and improve response times. By default, OfferServices uses Apache Ignite to handle caching of entities.

Cache Setup & Initialization

The cacheable entities within OfferServices are configured to be stored in their respective caches based on their TTL. See the subsections below for specific rules on the types of cache and the properties that can be configured.

For more details on caching setup, please see docs for enabling cache in a production environment.

Cache types

Within OfferServices, FullCacheType has been added to describe how the system should consider full cache of offer-related entities. By default, the type is set to ACTIVE_ONLY.

  • ALL - Include all items in the cache, including all that are marked as inactive.

  • ACTIVE_ONLY - Only include active items in the cache.

  • RANGE - Include all items that will (or have been) active in the provided temporal range.

Cache Initialization

FullCacheInitializationStatus describes the status of completion for the cache warming process. This status is either READY or NOT_READY, and will be returned during cache warming to inform the caller whether or not the full cache has been fully warmed.

Notable Properties

Properties for cache configuration can be found in the class, OfferCacheProperties.java.

For more details on these properties and their default values, see Caching properties and Cache Invalidation properties.

Cache Usages

The list of entities that are configured to enable cache:

  • ByTrackingIdContainer

    • Description: Lightweight cacheable structure to hold the campaign tracking ids relationship to offer. Stored within the offerCacheByTracking cache.

  • Offer

    • Description: Stored within offerCacheByIds, offerCacheByAutomatic, offerCacheByUserTargets, and offerCacheByVoucher caches.

  • OfferCode

    • Description: Stored within the offerCodeCacheByCodes cache.

  • Campaign

    • Description: Stored within the campaignCacheById cache.

  • MarketingMessages

    • Description: Stored within the marketingMessageCacheById cache.

Invalidate Cache

See Cache Invalidation in the Offer configuration docs for details on how to configure this feature and for the full list of configurable properties.