caching-utilities

Cache sync and async Python function results with memory, disk, or hybrid backends.

9|Updated Aug 8, 2023
One-click install
npx skills add https://github.com/anhvth/speedy_utils --skill caching-utilities
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: caching-utilities
Source: https://github.com/anhvth/speedy_utils/tree/main/.github/skills/caching-utilities
Command: npx skills add https://github.com/anhvth/speedy_utils --skill caching-utilities

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Caching utilities reduce unnecessary recomputation by storing results of expensive function calls and reusing them, improving performance and responsiveness across runs and sessions.

Core Features & Use Cases

  • Universal memoization with memory, disk, or hybrid backends for sync and async functions.
  • Interactive memoization for notebooks to persist caches during interactive sessions.
  • Object identification and stable keys to ensure correct cache hits across complex inputs.

Quick Start

Use memoize and imemoize decorators to enable caching for your functions and test performance with representative inputs.

Frequently Asked Questions about caching-utilities

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

FAQPage Schema
How do I cache expensive Python function results to reduce recomputation?

You can cache expensive Python function results by applying memoize decorators to store outputs in memory or on disk, reducing recomputation and latency across runs and sessions.

Does memoization work with async Python functions?

Yes, memoization works with both sync and async Python functions, supporting memory, disk, and hybrid caching backends to store and reuse expensive function call results.

Can I use caching utilities to persist function results in Jupyter notebooks?

Yes, you can use interactive memoization (imemoize) in notebooks to persist caches during interactive sessions, ensuring results remain available across cell executions.

What is the difference between memory and disk caching backends?

Memory caching stores function results in RAM for fast access, while disk caching persists results to storage for reuse across runs and sessions, with hybrid caching combining both approaches.

How does memoization handle complex inputs to ensure correct cache hits?

Memoization uses object identification and stable keys to ensure correct cache hits across complex inputs, preventing mismatched results when functions receive mutable or nested arguments.

When should I use hybrid caching instead of memory or disk caching alone?

Use hybrid caching when you need both fast in-memory access and persistent disk storage, combining the low latency of memory caching with the durability of disk caching across sessions.