frappe-core-cache

Implement Redis-based caching, invalidation, and distributed locking for Frappe applications.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/nathanabay/epc_bespo --skill frappe-core-cache-nathanabay
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: frappe-core-cache
Source: https://github.com/nathanabay/epc_bespo/tree/main/skills-frappe/core/frappe-core-cache
Command: npx skills add https://github.com/nathanabay/epc_bespo --skill frappe-core-cache-nathanabay

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve?

This Skill addresses the complexity of implementing efficient and reliable caching, cache invalidation, and distributed locking mechanisms in Frappe-based applications.

Core Features & Use Cases

  • Cache Management: Simplifies setting and getting cached values with TTL support, user scoping, and pattern deletion.
  • Hash Operations: Enables grouping related cache fields using Redis hashes, with easy retrieval and deletion.
  • Function Result Caching: Uses decorators to automatically cache function outputs, reducing database load.
  • Document Caching: Provides quick read-only access to cached documents and cache invalidation strategies to ensure data consistency.
  • Distributed Locking: Coordinates critical section execution through Redis-based locks, preventing race conditions.
  • Request-Scoped Cache: Offers per-request in-memory caching to improve performance during a single transaction.
  • Cache Invalidation Patterns: Guides on TTL-based, event-based, and hybrid invalidation strategies for maintaining data freshness.

Quick Start

Use frappe.cache.set_value to cache database query results with a 10-minute expiration.

Frequently Asked Questions about frappe-core-cache

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

FAQPage Schema
How do I implement distributed locking in Frappe to prevent race conditions?

Distributed locking in Frappe coordinates critical section execution using Redis-based locks and Python context managers, preventing race conditions across distributed systems. It manages lock control automatically during concurrent transactions.

How do I cache function results in Frappe to reduce database load?

You can cache function results in Frappe using decorators to automatically store outputs. This reduces database load by serving repeated function calls directly from the persistent Redis cache.

What is the best way to invalidate Frappe cache and maintain data consistency?

The best way to invalidate Frappe cache is using TTL-based, event-based, or hybrid invalidation strategies. These patterns ensure data freshness and consistency across cached documents and hash fields.

Can I use Redis hash operations for grouping related cache fields in Frappe?

Yes, you can use Redis hash operations in Frappe to group related cache fields. This allows easy retrieval and deletion of grouped cached data within your Frappe application.

Does Frappe support request-scoped in-memory caching for single transactions?

Frappe supports request-scoped per-request in-memory caching to improve performance during a single transaction. This prevents redundant database queries within the same request lifecycle.

How do I set a time-to-live when caching database query results in Frappe?

To set a time-to-live when caching database query results in Frappe, use the cache set_value method with a specified expiration time, such as 10 minutes, to persist data in Redis.