cache-policy-eviction

Manage and evict cache entries by tags with TTL policies.

1|Updated Feb 28, 2024
One-click install
npx skills add https://github.com/Sparkymod/Template --skill cache-policy-eviction
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cache-policy-eviction
Source: https://github.com/Sparkymod/Template/tree/main/.claude/skills/cache-policy-eviction
Command: npx skills add https://github.com/Sparkymod/Template --skill cache-policy-eviction

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill addresses the challenge of maintaining cache integrity by providing a method for selectively invalidating cache entries, ensuring that read paths reflect the most current data.

Core Features & Use Cases

  • Cache Policy Management: Define and apply cache policies with specific time-to-live (TTL) and tags for different entity types.
  • Tag-based Eviction: Use shared tags to evict cache entries across various read paths simultaneously, simplifying invalidation processes.
  • Service-Level Caching: Integrates with service-level caching mechanisms, with an option to opt-in for Redis-based caching.
  • Use Case: For instance, in a system with read-heavy data access patterns, this Skill can help ensure that changes to data are reflected in the UI in real-time by invalidating the relevant cache entries.

Quick Start

Run the cache policy eviction command with the 'EvictByTagAsync' method for the 'invoices' tag to clear the cache for all related entity reads.

Frequently Asked Questions about cache-policy-eviction

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I evict stale Redis cache entries using tags?

You can evict stale Redis cache entries by calling the EvictByTagAsync method with a specific tag, which clears all cache entries associated with that tag across various read paths simultaneously.

What is tag-based cache eviction and when do I need it?

Tag-based cache eviction is a method for selectively invalidating cache entries using shared tags. You need it when you want to evict related cache entries across multiple read paths at once to ensure read path consistency.

How do I set up cache policies with specific TTL for different entities?

You set up cache policies by defining specific time-to-live (TTL) and tags for different entity types. The system utilizes reflection to automatically register these cache policies for your application.

Can I use this cache eviction approach for service-level caching with Redis?

Yes, this approach integrates with service-level caching mechanisms and supports Redis as a caching provider. You can opt-in for Redis-based caching to manage your cache policies and evictions.

How does cache invalidation ensure real-time data reflection in read-heavy applications?

Cache invalidation ensures real-time data reflection by selectively removing stale cache entries when data changes. This guarantees that read paths reflect the most current data without waiting for TTL expiration.