-
Notifications
You must be signed in to change notification settings - Fork 551
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Upsert in SQLiteStore #3867
Comments
I'm not sure we can solve the first problem (since we don't know the vary headers in advance). But certainly the second. |
Agree with @ronag, the |
I'm probably missing something then. Can you clarify why you wouldn't have the vary headers? |
The vary header is part of the response, not the request. |
The current implementation is actually a bit broken since a more specific response (more vary dependencies) could overwrite a non stale and less specific response. But I don't think that's relevant in practice. |
As pointed out by @ronag in #3657, we can improve our SQLite store design by using a composite cache key as the ID of the table instead of an auto increment field.
One specific problem of our SQLiteStore design is that on reading the cache, we read all the values for a given route, independently of the
vary
headers:undici/lib/cache/sqlite-cache-store.js
Lines 375 to 421 in e49b575
For similar reasons in writing, we need to first read the cache, find if we have a matching row, and the go update that.
undici/lib/cache/sqlite-cache-store.js
Lines 276 to 315 in e49b575
We should be able to fix both problems at the same time by using a primary key that includes the vary headers, so we can avoid loading everything at once during getting.
For the algorithm to compute the key, check #3657 (comment).
The text was updated successfully, but these errors were encountered: