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.
CacheBuilder
behavior withoutCacheBuilder
with a little bit of code - doing so would allow you to specify TTL when you're adding items to cache.