Events Caching 2.0
  • 11 Dec 2024
  • 11 Minutes to read
  • Dark
    Light

Events Caching 2.0

  • Dark
    Light

Article summary

Caching 2.0 Terminology

Batched Cache Invalidation

  • Frequency: 1 minute
  • Cache invalidation occurs based on the actions performed in Salesforce. The path is Salesforce to cache.
  • All cache invalidation requests are grouped and processed in batches within one minute. This means that multiple requests are collected and executed together every minute instead of immediately invalidating the cache upon each request.
  • This system efficiently handles cache invalidation requests, ensuring none are lost, even if multiple requests come in simultaneously.

Auto Refresh

  • Frequency:
    • Event Group listing - Five minutes after the previous user visit
    • Event resources and Data Dictionaries - one hour after first user visit
  • Auto refresh serves as a backup mechanism for cache invalidation, providing an additional opportunity to update the cache.
  • It is triggered when a user visits a URL. As soon as the auto-refresh timing threshold is met for that URL, a refresh job is scheduled.
  • The auto-refresh threshold for Event Group listings is five minutes, meaning that if someone visits the listing after it has been cached for five minutes, a refresh job will be scheduled. The threshold for other resources, like Events and Data Dictionaries, is one hour.
  • Auto-refresh reuses the same jobs as cache invalidation.

Manual Actions

Publish Button

The Publish button existed prior to the Caching 2.0 update.

  • Where? This button is on the Events record page in the top right corner (in the BT Events Publish component).
  • What? Use this button to publish new or unpublished Events. It behaves similarly to the Update button, refreshing the Event and potentially triggering a refresh of the Event Group listing.
  • When? Use this button to publish a new Event or to republish an unpublished Event. Republishing an Event results in the same cache updates as the Update button.

Update Button

The Update button existed before the Caching 2.0 update.

  • Where? This button is on the Events record page in the top right corner (in the BT Events Publish component, underneath the Publish button).
  • What? When clicked, this button triggers a cache invalidation job that refreshes the Event within a one-minute batch. It also checks if the Event is included in its targeted Event Group listing. If it isn’t, a new job is scheduled to refresh the Event Group listing, ensuring that new Events or those moved into new Event Groups appear quickly. The entire process takes slightly over two minutes.
  • When?
    • If Event updates need to be reflected quickly. (It usually happens within two minutes.)
    • If an Event needs to be added to a new Event Group or moved back to the default Event Group listing quickly. (It usually happens within five minutes.)

Clear the Group Listing Cache Button

  • Where? The Clear the Group Listing Cache button is on the Event Group record page.
  • What? Clicking this button causes a reset and is heavier in processing. It refreshes the Event Group summaries and removes everything related to the Event Group, ensuring a fresh load on the next request. This resource-intensive operation may take several minutes and may lead to higher API calls on Salesforce's side and an increased load on the cache on the webapp side.
  • When?
    • If a user makes multiple changes that affect multiple Events in an Event Group. The update will happen on its own with up to an hour delay, but clicking this button forces the update immediately.

Update Group Listing Cache Button

  • Where? The Update Group Listing Cache button is located on the Event Group object.
  • What? Clicking this button allows users to refresh the Event Group summaries or listing, especially when adding/deleting an Event from the Event Group.
  • When?
    • If a user adds or deletes an Event from an Event Group. The update will happen on its own with up to a two minute day, but clicking this button forces the update immediately.

When Do Cache Updates Happen?

Caution

If you are using the nightly cache refresh job (Schedule Event Cache Refresh), you must turn it off before enabling Caching 2.0.

Go to the Blackthorn | Events Admin tab, click the Scheduled Jobs tab, and click the Disable Event Cache Refresh Job button.

Every Minute

The following tasks happen every minute once an Event's cache invalidation Salesforce job is complete.

  • Move an Event from one Event Group to another. The Event will no be longer visible on the original Event Group listing (i.e. not visible in the Event Group that it was removed from)
  • Delete an Event.
  • Remove an Event from an Event Group. The Event will no longer appear on the Event Group listing.
  • Update Event information, including all Event fields (i.e, Event Name, dates, Description). This only includes fields on the Event object.
  • Update Event Group information (i.e. filter, name, etc.).

Every Five Minutes

The following tasks happen every five minutes after a user visits the page, if the cache was stale when the user visited the page.

  • Used only with Event Group listings.
  • When a user moves an Event from one Event Group to another, the Event is visible on the new Event Group page.
    • Manually force an update by performing one of the following actions.
      • Click Update on the Event.
      • Republish the Event.
      • Click the Update Group Listing Cache button.

Every Hour

The following tasks fall into this category.

  • Update a Data Dictionary Group.
  • Update resources related to an Event, including Forms, Keywords, and Payment Gateways.

Manual Actions

The manual actions include clicking the Update button, republishing an Event, and refreshing the Event Group listing.

  • Change the Event Settings. To have the related Events reflect the updated values, you must perform one of the following actions.
    • Republish each Event related to the Event Settings.
    • Edit one of the Event’s fields to trigger an update.
    • Click the Update button.
  • Create a new Event. To trigger the cache, click Publish.
  • Add a new Event to an already-published Event Group. To make the new Event visible in the Event Group, click Publish.
  • Clone an Event. To trigger the cache, click Publish.
  • Update Form fields. To trigger the cache, republish the Event.
  • Create a new Form and add it to an Event, Event Item, or Session. To trigger the cache, republish the related record.

Other Resolved Issues

  • Events are only visible in the correct Event Groups.
  • When multiple Events are updated back-to-back, the changes will appear on the frontend for all updated Events. For example, if there are 10 Events, all 10 Events will be updated, not nine of the 10.

Use Cases

Delete an Event

  • Frequency: updates every 60 seconds.
  • The Event is removed from the Event Group listing once the cache invalidation is completed for the Event

Move an Event from one Event Group to Another

  • Frequency: updates when the first visit after five minutes happens
  • The Event is removed from the original Event Group once the cache invalidation is complete for the Event (within 60 seconds). The Event will then appear in the new Event Group listing after any of the following occurs.
    • A user clicks the Update Group Listing Cache button on the new Event Group.
    • A user clicks the Update button on the Event.
    • A user visits the Event Group URL after five minutes. (auto-refresh)

Remove an Event from the Event Group

  • Frequency: updates every five minutes
  • The Event is removed from the original Event Group listing once the cache invalidation is completed for the Event (within 60 seconds)..
  • The Event appears in the default Event Group listing once an auto-refresh occurs for the Event Group.

Set an Event’s Event Group Field

  • Frequency: updates every five minutes.
  • Set an Event’s Event Group field when the Event isn’t related to an Event Group.
  • Remove the Event from the Event Group.
  • The Event appears/disappears from the Event Group listing once an auto-refresh occurs for the Event Group.

Update Event Properties

  • Frequency: updates within 60 seconds.
  • Event properties refer to fields on the Event object, such as Event Name and Description.
  • Cache invalidation is triggered automatically on Salesforce.

Update Event Item or Event Session Properties

  • Frequency: updates within 60 seconds.
  • Cache invalidation for these objects is triggered automatically on Salesforce.
  • The Event that the Event Item or Session refers to is refreshed automatically.

Update the Payment Gateway Properties

  • Frequency: updates within 60 seconds.
  • The Payment Gateway property updates trigger an automatic cache invalidation on Salesforce.
  • The related Events need to be refreshed since the number of Events could be very large.
  • The Payment Gateway is refreshed automatically.
  • The Payment Gateway is attached to the Event dynamically when requested on the webapp, ensuring consistency across all related Events in the organization.

Update Event Settings, Forms, and Other Lookups on the Event

  • Frequency: updates with a manual action.
  • No cache invalidation is triggered automatically because of the potential for a large number of related Events.
  • The Event Settingss, Forms, and other Event record lookups are updated if a user clicks the Update button or republishes the Event.
  • The Event Settingss, Forms, and other Event record lookups are also updated if a user clicks the Clear the Group Listing Cache button.

FAQ

IMPORTANT

The previous hard refresh actions are no longer supported once you have upgraded to Cache 2.0.

Q: When will caching occur?
A: For most things, the cache will be refreshed within one minute. This includes the following.

  • Delete an Event.
  • Update the Event, Event Item, Session, and Event Group fields and related information.
  • Update the Payment Gateway fields and related information.

The cache will update when the first visit after five minutes happens for the following.

  • Move an Event from one Event Group to another.
  • Remove an Event from an Event Group.
  • Set an Event’s Event Group field when the Event isn’t related to an Event Group.

The following tasks can take up to one hour for the cache to refresh.

  • Update the Data Dictionary Group.
  • Update Event resources.

Q: How do I refresh the cache immediately?
A: To refresh the cache immediately, click one of the following buttons.

  • Event Record
    • Publish: Use this button to publish new or unpublished Events. It behaves similarly to the Update button, refreshing the Event and potentially triggering a refresh of the Event Group listing.
    • Update: When clicked, this button triggers a cache invalidation job that refreshes the Event within a one-minute batch. It also checks if the Event is included in its targeted Event Group listing. If it isn’t, a new job is scheduled to refresh the Event Group listing, ensuring that new Events or those moved into new Event Groups appear quickly. The entire process takes slightly over two minutes.
  • Event Group Record
    • Update Group Listing Cache: This button refreshes the Event Group summaries, pulling the latest Event Group list and updating the Event IDs. (It does not update Event content.) If an Event was unpublished and republished, it won't be visible until this button is pressed.
    • Clear the Group Listing Cache: This button performs process-heavy actions by refreshing the Event Group summaries and marking every Event in the summaries as stale, ensuring a fresh load on the next request. Despite being resource-intensive, the batch process will occur at one-minute intervals. However, this may lead to higher API calls on Salesforce's side and increased Redis load on the webapp side.

Q: I changed a lot of things in an Event Group. How do I make the changes visible as quickly as possible?
A: Click the Clear the Group Listing Cache button. It will clear the cache related to the Event Group including the Events in the Event Group and reset the Event Group listing.

Q: Are there any other ways to update the cache?
A: Yes, you can visit the preview link to force the latest data for an Event to load. The preview link shares the same cache as the regular link.

Q: I just published an Event in an Event Group, but it’s taking a while to appear there. How does this process work?
A: While a newly published Event goes live immediately, it may take more than two minutes for it to appear in the related Event Group. The time difference is due to several cache refreshes occurring in different parts of the app.

If you want the Event to appear faster, click the Update Group Listing Cache button after you use the Event Page URL to visit the Event. Updates are processed within one minute.

Q: Should I use the Update Group Listing Cache or Clear the Group Listing Cache button?
A: Use the Update Group Listing Cache button when the only change made to the Event Group was adding or deleting an Event.

Use the Clear the Group Listing Cache button after updating the Event Group. This button can also be used after adding or deleting Events, but it will temporarily increase load times since a new cache must be created for the Event Group.

Q: How do I add the Update Group Listing Cache or Clear the Group Listing Cache buttons to the Event Group page layout?
A: Complete the following steps to add the buttons.

  1. Click the Gear icon.
  2. Click Setup.
  3. In the Quick Find box, enter and click “Event Group.”
  4. Click the Page Layouts tab.
  5. Click “Event Group Layout.”
  6. In the “Salesforce Mobile and Lightning Experience Actions” section, click override the predefined actions. This will allow you to add the buttons.
    Caching_AddButtonEventGroup_1
  7. Click the Mobile & Lightning Actions tab.
  8. Drag and drop the Clear the Group Listing Cache and Update Group Listing Cache buttons to the “Salesforce Mobile and Lightning Experience Actions” section.
    Caching_AddButtonEventGroup_2
  9. Click Save.