Skip to main content
Database Cache is the tenant application-cache namespace exposed in Databases → Cache. Use it for derived or short-lived state that can be rebuilt from a durable source. It is not a replacement for a Table, Storage object, Job history, or external system of record.

Choose the correct cache boundary

The platform enforces the application cache root server-side. Customers work with logical keys such as pricing:eur:2026-09-05; they cannot use this surface to browse unrelated operational cache namespaces.

Key design

Use stable prefixes and include every scope that affects the value:
  • Keep keys free of credentials and personal data.
  • Use a finite TTL unless the value has an explicit invalidation owner.
  • Version the prefix when the serialized value or meaning changes.
  • Avoid broad wildcard actions in request-time code.
  • Store large documents and files in Storage, then cache a compact identifier.

Work in the UI

The Database Cache workspace can list logical keys, load values, inspect type and size, read expiration, create or replace a key, change TTL, make a key persistent, and delete one or more keys. Resource Read can inspect cache state; Resource Write and Resource Admin can mutate it. Use the UI for investigation and deliberate administration. Application code should use the atomic low-code operations rather than implementing a read-then-write race through separate HTTP requests.

Read-through caching

api.getOrSetInstanceCache() atomically returns the existing value or writes the fallback when the key is absent:
The fallback is not a transaction with the preceding provider call. Multiple callers can still contact the provider before one value wins. Use a concurrency or idempotency primitive when duplicate upstream work is expensive.

Idempotency and atomic coordination

Use the dedicated helpers instead of encoding a lock with normal get/set calls:
incrementInstanceCache() and decrementInstanceCache() update integer counters atomically. compareAndSetInstanceCache() changes a value only when the current serialized value matches the expected value. concurrencyLimit() admits a bounded number of callers for a key within its TTL window. Choose that TTL as part of the admission policy; there is no separate concurrency-token release method on this surface.

TTL and persistence

setInstanceCache(key, value, seconds) and the atomic helpers accept an optional TTL in seconds. The remaining TTL is returned by getExpireInstanceCache():
  • a positive number means seconds remain;
  • 0 means the key exists without expiration;
  • null means the key does not exist.
Use expireInstanceCache(key, ttl) to set a new TTL and persistInstanceCache(key) to remove expiration. A persistent cache entry still is not a durable business record: administrators, maintenance, or capacity policy can invalidate cache state.

Batch administration limits

The Platform API exposes bounded administration operations: For expiration batches, -1 removes expiry, 0 deletes matching keys, and a positive integer sets seconds-to-live. Wildcard operations can touch many keys; scope the prefix narrowly and run them as an explicit operator action.

Failure and recovery

Do not make authorization, financial truth, or irreversible side effects depend only on the continued existence of a cache key. For idempotency around an external write, pair the cache guard with a durable business record or provider idempotency key.

Production checklist

  • Define a durable source of truth and a cache-miss path.
  • Use namespaced, versioned logical keys.
  • Set a TTL and record the invalidation owner.
  • Prefer atomic helpers for idempotency, counters, compare-and-set, and concurrency.
  • Keep values compact and free of Secrets or raw authorization data.
  • Test expiry, duplicate callers, stale shapes, and cache unavailability.
  • Observe hit rate and rebuild cost before increasing lifetime.
  • Use the generated api reference for every current method signature.
See Databases for durable records and Production patterns for retry and idempotency design.
Last modified on September 5, 2026