diff --git a/diigo-cache/src/api.ts b/diigo-cache/src/api.ts index 745cd9b..f200ec3 100644 --- a/diigo-cache/src/api.ts +++ b/diigo-cache/src/api.ts @@ -28,9 +28,10 @@ type Fillable = { startFill(opts?: { pagesPerStep?: number }): Promise; fillStatus(): Promise; stopFill(): Promise; + 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 { 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 */ diff --git a/diigo-cache/src/cache-page.ts b/diigo-cache/src/cache-page.ts index c019f62..b34d1ae 100644 --- a/diigo-cache/src/cache-page.ts +++ b/diigo-cache/src/cache-page.ts @@ -28,12 +28,18 @@ export const CACHE_PAGE_HTML = `

no fill job yet

+

+ +

← home