gemini-api-caching
Best practices for Gemini API caching strategy including cache versioning, entity-stable keys, and cache busting for WescoBar
Security Assessment
About gemini-api-caching
The Gemini API Caching skill provides a caching strategy designed to improve performance and reduce costs for Gemini API calls. By implementing robust caching techniques, this skill helps to minimize unnecessary API calls, reduce latency, and enhance user experience. It achieves this by employing cache versioning, entity-stable keys, and cache busting techniques to ensure content is cached efficiently and updated when necessary. This approach is ideal for applications where API usage is costly or where content can be reused across multiple sessions.
FAQ
How do I implement cache versioning?
Cache versioning is implemented by defining a global cache version constant (e.g., 'v2') and prepending it to all cache keys. This allows for global cache invalidation when the version is bumped.
What is the purpose of entity-stable keys?
Entity-stable keys are used to ensure that content related to specific entities (e.g., character portraits) consistently maps to the same cache key, even if there are minor changes in the prompts or other non-essential attributes. This reduces unnecessary cache invalidation and improves cache hit rates.
How do I force cache invalidation?
Cache invalidation can be forced by setting the 'forceRebuild' flag when fetching content, or by manually clearing cache entries using 'localStorage.removeItem()' for specific keys or clearing all related cache items.
Install gemini-api-caching
Quick Setup:
- Copy the skill folder to
.claude/skills/ - Claude will automatically detect and use the skill
Repository
BerryKuipers/claude-code-toolkit