Broadleaf Microservices
  • v1.0.0-latest-prod

Caching Offers


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,

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

To enable cache invalidation message flow, set When updating an entity, a message is sent to invalidate the entity cache for discrete cache invalidation. Cache invalidation for each entity can be invalidated partially or can require a full eviction of the entity cache depending on the reset property specified on the event message. Cache invalidation can also be influenced by the ability to delay cache event messages for a time, as defined by the message send delay properties for offers and offer codes.

See Cache Invalidation for the full list of configurable properties.