Skip to main content

PurgeRule

Defines a rule that listens for a particular VendureEvent and uses that to make calls to the Stellate Purging API via the provided StellateService instance.

Signature
class PurgeRule<Event extends VendureEvent = VendureEvent> {    eventType: Type<Event>    bufferTimeMs: number | undefined    handle(handlerArgs: { events: Event[]; stellateService: StellateService; injector: Injector }) => ;    constructor(config: PurgeRuleConfig<Event>)}

eventType

propertyType<Event>

bufferTimeMs

propertynumber | undefined

handle

method(handlerArgs: { events: Event[]; stellateService: StellateService; injector: Injector }) =>

constructor

method(config: PurgeRuleConfig<Event>) => PurgeRule

Configures a PurgeRule.

Signature
interface PurgeRuleConfig<Event extends VendureEvent> {    eventType: Type<Event>;    bufferTime?: number;    handler: (handlerArgs: {        events: Event[];        stellateService: StellateService;        injector: Injector;    }) => void | Promise<void>;}

eventType

propertyType<Event>

Specifies which VendureEvent will trigger this purge rule.

bufferTime

propertynumber
Default:5000

How long to buffer events for in milliseconds before executing the handler. This allows us to efficiently batch calls to the Stellate Purge API.

handler

property(handlerArgs: { events: Event[]; stellateService: StellateService; injector: Injector; }) => void | Promise<void>

The function to invoke when the specified event is published. This function should use the StellateService instance to call the Stellate Purge API.

Was this chapter helpful?
Report Issue
Edited Feb 2, 2026·Edit this page