palbaseDocs

API reference

Palbase Cache

Palbase's cache module: a project's short-lived entries — a value a server computed and wants again — in one shared, multi-tenant service on a Valkey of its own. The project is the one the key was issued for: no request names a project, and no project reaches another's entries.

Only the project's secret key reads and writes the cache (apikey header, role service_role; a machine's own key is one), without a user's token beside it. A publishable key ships in apps and is refused.

Every entry runs out: after its ttl, thirty days at most. An entry weighs what the cache keeps for it — its value and its key three times, a quarter more, and 320 bytes — and a project's entries together weigh at most its quota (GET /cache/usage). A write past the quota does not fail: the project's own entries nearest their end are dropped to make room. When every project's entries together fill the cache, the project that weighs the most gives back first; a project under its share keeps its entries. The cache is a cache: an entry may be gone before its time, and what must not be lost belongs in a database.

A project reads and writes at most so many bytes a second (the second's first call is taken whatever its size), and makes at most its requests per second of calls; past either, a call is answered 429 with Retry-After. The cache's calls are not counted as the project's requests, and an answered one is not a line of the project's request log; the bytes its reads carry out are counted for the project (cache.egress).

The contract itself: /openapi/cache.openapi.json

CacheEntries

CacheUsage