You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs: Document per-principal cache namespacing and scope headers (#1656)
* docs: Document per-principal cache namespacing and scope headers
When authentication is enabled, all cache layers are now automatically
scoped per principal. Documents the new Results-Cache-Scope and
Search-Results-Cache-Scope response headers, the Vary: Authorization
behavior, and the breaking change requiring caching accelerator storage
migration.
Source: spiceai/spiceai#10702
* fix: correct broken link to auth docs
The auth documentation is at api/auth, not ../auth.
---------
Co-authored-by: claudespice <claudespice@users.noreply.github.com>
Copy file name to clipboardExpand all lines: website/docs/features/caching/index.md
+34-6Lines changed: 34 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -90,16 +90,34 @@ The encoding algorithm determines how cached results are compressed in memory, t
90
90
91
91
Use `zstd` when maximizing cache efficiency is important, especially for large queries that would otherwise quickly fill the cache. Use `none` for the lowest latency when memory is not constrained.
92
92
93
+
## Per-Principal Cache Isolation
94
+
95
+
When [authentication](../../api/auth) is enabled, all cache layers (SQL results, search results, and caching-mode acceleration storage) are automatically scoped per principal. Each authenticated caller has an isolated cache namespace — one caller's cached output is never served to a different caller.
96
+
97
+
| Scenario | Cache namespace |
98
+
| --- | --- |
99
+
| Auth disabled or anonymous request | `public` — all callers share the cache |
100
+
| Authenticated principal (e.g., API key) | Per-principal — isolated by a hash of the principal's identity |
101
+
| Background / system tasks (e.g., SWR revalidation) | Inherits the originating principal's namespace |
102
+
103
+
There are no user-facing knobs to disable isolation. Scope follows authentication presence by construction.
104
+
105
+
:::warning[Breaking change for caching accelerator]
106
+
The caching accelerator storage schema gains an internal `__spice_cache_namespace` column. Existing accelerator storage from earlier versions must be deleted (e.g., remove the `duckdb_file`, drop the backing table) before upgrading. The runtime errors with a clear message at startup if it encounters a non-extended schema.
107
+
108
+
The SQL results cache and search cache are in-memory and require no migration.
109
+
:::
110
+
93
111
## Cached Responses
94
112
95
-
Responses from HTTP APIs include a header that indicates the cache status of the applicable cache:
113
+
Responses from HTTP APIs include headers that indicate the cache status and scope:
0 commit comments