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:
1 parent
cffb1fa9b2
commit
904f620f06
5 files changed
+91
-1
No files matched your search
@@ -28,12 +28,18 @@ export const CACHE_PAGE_HTML = `<!doctype html>
|
||||
<p id="private-status">no fill job yet</p>
|
||||
<button type="button" data-target="private" data-action="start">fill</button>
|
||||
<button type="button" data-target="private" data-action="stop">stop</button>
|
||||
<p><label>invalidate the last <input type="number" id="private-days" min="1" max="3650" value="7" size="5"> days</label>
|
||||
<button type="button" data-target="private" data-action="invalidate">invalidate</button>
|
||||
<span id="private-invalidated"></span></p>
|
||||
</section>
|
||||
<section id="public" hidden>
|
||||
<h2>public cache</h2>
|
||||
<p id="public-status">no fill job yet</p>
|
||||
<button type="button" data-target="public" data-action="start">fill</button>
|
||||
<button type="button" data-target="public" data-action="stop">stop</button>
|
||||
<p><label>invalidate the last <input type="number" id="public-days" min="1" max="3650" value="7" size="5"> days</label>
|
||||
<button type="button" data-target="public" data-action="invalidate">invalidate</button>
|
||||
<span id="public-invalidated"></span></p>
|
||||
</section>
|
||||
<p><a href="/">← home</a></p>
|
||||
<script type="module">
|
||||
@@ -105,6 +111,13 @@ async function main() {
|
||||
button.addEventListener("click", () => {
|
||||
const { target, action } = button.dataset;
|
||||
const j = job(target);
|
||||
if (action === "invalidate") {
|
||||
const days = Number($(target + "-days").value);
|
||||
j.invalidateRecent(days)
|
||||
.then((r) => ($(target + "-invalidated").textContent = "dropped " + r.pages + " cached pages; fill to refetch"))
|
||||
.catch(report);
|
||||
return;
|
||||
}
|
||||
(action === "start" ? j.startFill() : j.stopFill())
|
||||
.then(() => refresh(hasPublic))
|
||||
.catch(report);
|
||||
|
||||
Reference in new issue
Block a user