Background
A Cache is meant to back an Index — Seek looks up start keys from the cache, and Scan continues from those start keys against the index. For this handoff to stay consistent, a cache must always exist paired with the index it backs.
Today the schema lets Cache be declared on its own, separate from any Index. That makes it easy for a cache to drift out of sync with the index it's supposed to back. We want to fix this at the schema level by making Cache a child of Index, so the two can never be defined independently.
There is also a related cleanup: Seek returns a set of start keys (not a single position), so the offset field on the Seek API no longer makes sense and should be removed first.
Task
Done When
- The Seek API no longer accepts
offset.
- An index declares its cache inline, as shown below, and Seek/Scan share the same key layout end-to-end.
- Existing tests pass; new tests cover the nested-cache path.
{
"indices": [
{
"name": "permission_created_at_desc",
"fields": [
{
"name": "permission",
"order": "ASC"
},
{
"name": "createdAt",
"order": "DESC"
}
],
"desc": "createdAt desc index",
"cache": {
"dimension": [
{
"field": "permission",
"values": [
"others"
]
}
],
"limit": 100
}
}
]
}
Notes
- Callers that used
offset on Seek should switch to paging with the Scan cursor.
- Existing top-level
cache entries need to be moved under their owning index.
Background
A Cache is meant to back an Index — Seek looks up start keys from the cache, and Scan continues from those start keys against the index. For this handoff to stay consistent, a cache must always exist paired with the index it backs.
Today the schema lets Cache be declared on its own, separate from any Index. That makes it easy for a cache to drift out of sync with the index it's supposed to back. We want to fix this at the schema level by making Cache a child of Index, so the two can never be defined independently.
There is also a related cleanup: Seek returns a set of start keys (not a single position), so the
offsetfield on the Seek API no longer makes sense and should be removed first.Task
offsetfrom the Seek API (request schema, server, clients) — done firstcacheunderindexin the schemacacheentriesDone When
offset.{ "indices": [ { "name": "permission_created_at_desc", "fields": [ { "name": "permission", "order": "ASC" }, { "name": "createdAt", "order": "DESC" } ], "desc": "createdAt desc index", "cache": { "dimension": [ { "field": "permission", "values": [ "others" ] } ], "limit": 100 } } ] }Notes
offseton Seek should switch to paging with the Scan cursor.cacheentries need to be moved under their owningindex.