1

I am using CacheBuilder to store data retrieved from GET /ui-api/object-info/{objectApiName}/picklist-values/{recordTypeId}, so as to reduce the number of callouts made to org.

After reading the limits, I see that Default org cache time-to-live is 86,400 seconds (24 hours). Limits shown here

But when I tried this (Cache.org.get(PicklistCache.class, 'local.Utility' + '.' + 'RECORDTYPEID')) on scratch org, which is a enterprise edition, I see that the API gets hit after 5 or so minutes again.

Does scratch orgs have less TTL? And is there a documentation for this?

I even checked Org Cache Diagnostics for partition Page, I can see it there for some time, but it gets deleted automatically after sometime.

I got a link here which does looks similar. May be someone is deploying something, or running anonymous apex, or running test classes. Keeping this in mind, this shouldnt be frequent in production, fingers crossed.

3
  • Possible reason: your cache partition is sized small and it's full or close to full. Another reason (unconfirmed and a guess): TTL limits are different in a scratch org. It's easy to mimic CacheBuilder behavior without CacheBuilder with a little bit of code - doing so would allow you to specify TTL when you're adding items to cache.
    – identigral
    Commented Jul 6, 2023 at 15:45
  • Yeah but there is no guarantee of that with code. Because even default is of 24 hours but it gets deleted anyhow. I assume same would be the case with custom too. Commented Jul 6, 2023 at 17:11
  • Default (or rather eviction via default) is subject to undocumented conditions, explicit TTL is a stronger constraint.
    – identigral
    Commented Jul 6, 2023 at 18:26

0

You must log in to answer this question.

Browse other questions tagged .