Summary
Explore an optional indexed invalidation path, such as tags or namespaces, so callers can delete related entries without scanning the full cache.
Why
deleteByPrefix() and deleteByMagicString() scan all keys. That is simple and useful, but prefix/wildcard deletion is a promoted capability, so larger caches may need a faster invalidation model.
Current references
src/cache.ts: deleteByPrefix()
src/cache.ts: deleteByMagicString()
Review questions
- Is tag-based invalidation worth the additional internal index maintenance?
- Should tags be supplied via
set(key, value, { tags }) and getOrSet(key, fetcher, { tags })?
- Can we keep existing wildcard APIs scan-based and add tags as an opt-in fast path?
Acceptance criteria
- Proposed API keeps zero dependencies and preserves existing deletion methods.
- Indexed invalidation removes only matching entries and cleans associated metadata.
- Tests cover delete by tag/namespace, overwrites, deletes, clear, and TTL expiration cleanup.
Summary
Explore an optional indexed invalidation path, such as tags or namespaces, so callers can delete related entries without scanning the full cache.
Why
deleteByPrefix()anddeleteByMagicString()scan all keys. That is simple and useful, but prefix/wildcard deletion is a promoted capability, so larger caches may need a faster invalidation model.Current references
src/cache.ts:deleteByPrefix()src/cache.ts:deleteByMagicString()Review questions
set(key, value, { tags })andgetOrSet(key, fetcher, { tags })?Acceptance criteria