Actions Cache Consistency Between Executions

Overview

The Actions cache is documented to persist for a max of 24 hours (see this link for reference).

However, sometimes the cache does not seem to persist across executions (different login flows, for example), even within this period or shorter:

  1. Set a dummy item, such as a token in a Post Login Action cache from one Action api.cache.set(key, value, [options]);
  2. Perform a second login (or multiple) trying to get the cached value api.cache.get(key) and notice that it may not be present in all of the runs.

Applies To

  • Actions Cache

Cause

The cache should be available for all actions in the same flow for a single execution reliably, however for subsequent executions (e.g. a different flow, another user login, or a user returning from a redirect action) it is not guaranteed.
Cached items have a maximum lifetime of 24 hours but it could be less than this. This is mentioned in this Community post and here.

Solution

The Action’s code should check the cache and be able to fetch and store the value if needed.

2 Likes