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.