invalidateByTag

suspend fun invalidateByTag(tag: String, scope: String? = null): Int

Drops every entry carrying tag, optionally narrowed to scope, and returns how many went.

A TTL is a guess about when knowledge might go stale; this is how you act on knowing that it just did. Tag entries by the fact they depend on — a price list, a policy version — and drop exactly those when it changes, instead of clearing a whole scope and paying to refill it.

The exact-match layer is cleared wholesale rather than by tag: it holds no tag index, and dropping everything is the safe direction. Its entries cost one lookup each to rebuild; keeping one that a caller has just invalidated would serve a wrong answer.

Throws

if the configured CacheStore does not index tags.