remote-index-cached-as-rows-with-validator
Installation
SKILL.md
A remote index, stored as rows, revalidated by ETag
Some catalogues are published as one big static file — hundreds of kilobytes, thousands of entries, updated occasionally. Three separate decisions make this cheap:
- Rows, not a blob. Parse once into a table so a search is an indexed query, not a re-parse.
- A time-to-live before you even ask whether the file changed.
- The server's own validator for the ask itself, so "unchanged" costs headers only.
suspend fun refreshIndex(force: Boolean): Boolean {
val meta = local.indexMeta()
val cached = local.entryCount()
val now = Clock.System.now().toEpochMilliseconds()
if (!force && meta != null && cached > 0 && now - meta.fetchedAt < INDEX_TTL_MS) return false