Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions examples/app-showcase/src/system/apis/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,18 @@ export const TaskFeedEndpoint: ApiEndpoint = {
operation: 'find',
},
authRequired: true,
// Seconds. Emitted as `Cache-Control: public, max-age=30` on a SUCCESSFUL
// Seconds. Emitted as `Cache-Control: private, max-age=30` on a SUCCESSFUL
// answer only — never on a 401/429/5xx, because telling a client to reuse a
// failure for half a minute is worse than saying nothing. GET-only by rule:
// publish rejects `cacheTtl` on any other method rather than parsing it and
// ignoring it.
// failure for half a minute is worse than saying nothing. `private` is not
// this example's tuning choice: the runtime emits it for every positive
// ttl, on `authRequired: false` endpoints too, because any answer can be
// RLS-trimmed for its caller and a shared cache must never store one and
// hand it to somebody else. `computeCacheControl` in
// `packages/runtime/src/endpoint-policy.ts` states that rule and the rest of
// the ladder with it — including `cacheTtl: 0`, which is `no-store` rather
// than "no header": writing 0 says something, and saying nothing is spelled
// by omitting the key. GET-only by rule: publish rejects `cacheTtl` on any
// other method rather than parsing it and ignoring it.
cacheTtl: 30,
};

Expand Down
Loading