SfSkills Domains Docs GitHub

Home / omnistudio / omnistudio-cache-strategies

omnistudio-cache-strategies

Configure caching on DataRaptors and Integration Procedures for response-time gains. Triggers: OmniStudio cache, DataRaptor cache, IP cache TTL. NOT for IP-specific cacheable design — use omnistudio/integration-procedure-cacheable-patterns.

Open the skill folder on GitHub


OmniStudio Cache Strategies

Use this skill when deciding whether, where, and how to cache an OmniStudio read path — and when diagnosing a cache that appears configured but is not changing anything. It covers the three distinct caches that share the word "cache" in OmniStudio, the Platform Cache limits every one of them inherits, and the security consequences of serving a payload that was computed for somebody else.


Before Starting


The Three Caches

Naming the layer is the whole diagnostic. These are independent:

LayerStoresConfigured bySymptom when misconfigured
Component metadata cachethe compiled component definitionisMetadataCacheDisabled (boolean, default false — so it is on by default) on OmniIntegrationProcedure and OmniScriptslow cold start after deploy
Response cachethe output payloadData Mapper Options tab (Platform Cache Type, Time to Live in Minutes); IP Cache Configuration section (whole response) or Cache Block element (enclosed steps); responseCacheType in metadata, plus responseCacheTtlMinutes on the Data Mapper type onlywarm reads no faster than cold
Platform Cachethe underlying key/value substrateSetup → Platform Cache partition allocationnothing is cached at all, silently

isMetadataCacheDisabled is a negative. Default false means metadata caching is already enabled; setting it true turns caching off. It is a debugging lever, not a performance lever, and flipping it will not change what a warm read returns.


The Limits That Decide The Design

Every OmniStudio response cache sits on Platform Cache and inherits its bounds. These are the numbers that most often invalidate a proposed design:

ConstraintValue
TTL minimum (org and session)300 s / 5 minutes
TTL maximum — org cache172,800 s / 48 hours (default 86,400 s / 24 h)
TTL maximum — session cache28,800 s / 8 hours
Maximum cache key size50 characters
Cache key charactersalphanumeric only — put() throws Cache.InvalidParamException otherwise
Maximum size of a single cached item100 KB
Minimum partition size1 MB
Maximum local cache per partition, per request500 KB session / 1,000 KB org

Three consequences worth internalising:

  1. A freshness requirement tighter than 5 minutes is a decision **not to

    cache**, not a smaller number in the TTL field.

  2. The Redis-style key catalog:v2:region=NA is illegal on this platform.

    Use camelCase with no separators.

  3. Caching the whole aggregate response usually exceeds 100 KB. Cache the

    resolved decision instead.


Security Consequences Of A Warm Read

A cache hit returns a payload computed during somebody else's request, under that request's permission evaluation. Two documented facts and one reported behaviour follow:

The defensive posture the third bullet implies is sound regardless of whether the specific bypass reproduces in your org: an access check that runs only on a cold path is not an authorization boundary. Gate on the object and field permissions of the running user and on the sharing model, which are evaluated per call.

Keep fieldLevelSecurityEnabled true on Data Mappers. It governs the cold path, and the cold path decides what every subsequent warm read returns.


  1. Establish the runtime (standard vs managed package) and confirm Platform

    Cache partition allocation is non-zero. Stop here if it is zero — nothing downstream is measurable until it is fixed.

  2. Measure the read path cold, as a user from the target audience. Record p50

    and p95 and the serialized payload size in bytes.

  3. Classify the payload: identical for everyone, or scoped to a person. This

    choice — not the desired hit ratio — sets responseCacheType to org or session. Anything guest-reachable or containing PII defaults to no cache.

  4. Set a TTL inside the platform range (5 min – 48 h org, 5 min – 8 h session)

    that matches the agreed freshness contract. If the contract is tighter than 5 minutes, record the decision not to cache and stop.

  5. Design invalidation before shipping: a version discriminator inside the

    cache key for routine releases, plus a documented purge path for incidents. A TTL alone is a staleness bound, not an invalidation mechanism.

  6. Verify in the runtime context, as two different users, comparing payloads

    and not only elapsed time. Designer preview timings do not demonstrate the response cache.

  7. Instrument hit ratio and cold-start load. Plan capacity for the cold-start

    spike that follows an eviction — cache "isn't persisted" and an Apex deploy may clear it.


Review Checklist


Worked Examples (see references/examples.md)

Common Gotchas (see references/gotchas.md)

Top LLM Anti-Patterns (full list in references/llm-anti-patterns.md)


Official Sources Used

See references/well-architected.md for the full source list with the specific claim each source grounds.

Package files