cache-usage

Implement dual-backend caching with Redis and in-memory stores for Genies apps.

1|Updated Mar 16, 2024
One-click install
npx skills add https://github.com/tdcare/genies --skill cache-usage
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cache-usage
Source: https://github.com/tdcare/genies/tree/main/.qoder/skills/cache-usage
Command: npx skills add https://github.com/tdcare/genies --skill cache-usage

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

genies_cache provides a dual-backend caching solution (Redis and in-memory) to simplify caching strategy across environments and improve performance and testability.

Core Features & Use Cases

  • Unified interface for caching with TTL, JSON storage, and atomic operations.
  • Seamless switch between Redis-backed production caches and memory-backed tests with minimal code changes.
  • Use cases include session caching, distributed locks, and idempotent operation management in Genies microservices.

Quick Start

Install and configure the dual-backend cache, then initialize the service in your app context and perform basic CRUD with set/get/del.

Frequently Asked Questions about cache-usage

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

FAQPage Schema
How do I implement distributed locking for Genies microservices?

Distributed locking for Genies microservices is implemented using atomic NX operations provided by the dual-backend caching service. This allows you to safely manage idempotent operations and distributed locks across microservices using either Redis or in-memory backends.

Can I use an in-memory cache for testing and Redis for production without changing code?

Yes, you can seamlessly switch between memory-backed test caches and Redis-backed production caches with minimal code changes. The service implements a unified ICacheService interface to simplify your caching strategy across different environments.

Does this caching service support TTL and JSON storage?

Yes, the caching service supports TTL queries, JSON storage, and atomic operations. It provides a unified interface allowing you to set, get, and delete cache entries while managing expiration times effectively.

What is the best way to set up session caching in Genies apps?

The best way to set up session caching in Genies apps is using the dual-backend cache service. Initialize the service in your application context, configure it via application settings, and perform basic CRUD operations using set, get, and del methods.

How do I configure the dual-backend cache in my application settings?

You configure the dual-backend cache via your application settings to define backend preferences. After installing and configuring the service, initialize it in your app context to perform basic CRUD operations with set, get, and del methods.