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

+9 -1
View File
@@ -28,9 +28,10 @@ type Fillable = {
startFill(opts?: { pagesPerStep?: number }): Promise<FillStatus>;
fillStatus(): Promise<FillStatus | undefined>;
stopFill(): Promise<FillStatus>;
invalidateRecent(days: number): Promise<{ pages: number }>;
};
/** a cache's fill job, and nothing else */
/** a cache's fill job and page invalidation, and nothing else */
export class FillCap extends RpcTarget {
#cache: Fillable;
@@ -55,6 +56,13 @@ export class FillCap extends RpcTarget {
async stopFill(): Promise<FillStatus> {
return this.#cache.stopFill();
}
/** drop the cached pages holding anything updated in the last `days`
* days (1–3650), so they refetch */
async invalidateRecent(days: unknown): Promise<{ pages: number }> {
if (typeof days !== "number") throw new Error("days: expected a number");
return this.#cache.invalidateRecent(days);
}
}
/** what the holder of a private cache's key may do */