diigo-cache: invalidate the last N days of cached pages

invalidateRecent(days) drops the cached pages holding anything diigo
updated within the last N days (on the cache's injected clock), and
every page before them, so the next read or fill refetches them; item
rows stay. Exposed on the fill capability (private and public) and on
the webkey page as "invalidate the last N days" per cache.

A user-requested refetch, not a change in what stored state means.

Generated-by: Claude Opus 5.5
This commit is contained in:
dckc committed 2026-10-07 08:27:13 -05:00
1 parent cffb1fa9b2
commit 904f620f06
5 files changed
+91 -1

No files matched your search

+14
View File
@@ -300,6 +300,20 @@ describe("fill via webkey and Cap'n Web (goal 1e)", () => {
expect(html).toContain("event.preventDefault()");
});
it("the capability can invalidate recent pages; the page offers it for each cache", async () => {
const { cacheId } = await wireJson("private");
const { api, done } = session();
try {
expect(await api.cache(cacheId).invalidateRecent(7)).toEqual({ pages: 0 });
} finally {
done();
}
const html = await (await call("/cache/")).text();
expect(html).toContain('id="private-days"');
expect(html).toContain('data-action="invalidate"');
expect(html).toContain("invalidateRecent(days)");
});
it("serves capnweb's browser build itself (no third-party script beside the key)", async () => {
const res = await call("/_capnweb.js");
expect(res.headers.get("content-type")).toMatch(/javascript/);