CacheHandle

interface CacheHandle

Optional capability for cache policies that support invalidation by key or prefix.

Use ResilientPolicy.cacheHandle to obtain this when the policy was built with cache enabled. InMemoryCachePolicy implements this interface.

Functions

Link copied to clipboard
abstract suspend fun invalidate(key: String)

Removes the cache entry for key, if present.

Link copied to clipboard
abstract suspend fun invalidatePrefix(prefix: String)

Removes all cache entries whose key starts with prefix. No-op if no keys match.