cache-to-disk
Local disk caching decorator for python function.
Decision gist · record as of 2026-08-14
Yes, if you need simple, argument-aware disk caching for expensive functions and can accept dormant maintenance. The package is permissive-licensed, has no dependencies, and installs easily. However, the last update was in 2021—if you need active support, bug fixes, or compatibility with future Python versions, consider alternatives or be prepared to maintain a fork.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Low install friction with no runtime dependencies.
- Maintenance is dormant—last release was 2021-12-07 and last commit 2023-12-29, so expect no active support or updates.
License · maintenance · safety
permissive license (permissive) — MIT license (permissive) means you can use, modify, and distribute this package freely with minimal restrictions.
last release 2021-12-07 (1711 days) · last repo commit 2023-12-29 · 35 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 110,646 downloads/mo, #12,448 on PyPI
Alternatives
Verify before relying
pip install cache-to-disk
from cache_to_disk import cache_to_disk
@cache_to_disk(3)
def my_function():
return [i * j for i in range(10000) for j in range(i)]
result = my_function() # Cached for 3 days- Whether pickle serialization is safe for untrusted function return values or if there are known deserialization risks.
- Performance characteristics when caching large objects or handling concurrent access to the same cache files.
- Compatibility with modern Python versions beyond what the unspecified python_support indicates.
What it is and what it does
cache_to_disk is a Python decorator that persists function results to disk as pickled files instead of holding them in memory. It's designed for functions that are expensive to run and produce large return values—cases where in-memory caching would be wasteful. Each cached result is keyed by the function's arguments, so different argument combinations trigger fresh execution. You specify a cache lifetime in days; after that period, the cached file is deleted on the next module import.
The package provides three main functions: the @cache_to_disk(n_days) decorator itself, a delete_disk_caches_for_function() utility to manually invalidate a function's cache, and a cache_info() method to inspect hit/miss statistics. It also supports a NoCacheCondition exception to prevent caching in error scenarios while still returning a partial result.
Use it for
- Cache expensive data-processing pipelines that return large objects for days at a time.
- Avoid re-querying slow external APIs or databases when the same arguments are used within a cache window.
- Store intermediate results from long-running computations without consuming RAM.
- Manually invalidate cached results when a function's logic changes or external data is updated.
- Track cache performance with cache_info() to understand hit rates and identify optimization opportunities.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you need simple, argument-aware disk caching for expensive functions and can accept dormant maintenance.
The package is permissive-licensed, has no dependencies, and installs easily. However, the last update was in 2021—if you need active support, bug fixes, or compatibility with future Python versions, consider alternatives or be prepared to maintain a fork.
Install
cache-to-disk on PyPI
Before you install
Low install friction with no runtime dependencies. Maintenance is dormant—last release was 2021-12-07 and last commit 2023-12-29, so expect no active support or updates.
License in practice
MIT license (permissive) means you can use, modify, and distribute this package freely with minimal restrictions.
Quickstart
pip install cache-to-disk
from cache_to_disk import cache_to_disk
@cache_to_disk(3)
def my_function():
return [i * j for i in range(10000) for j in range(i)]
result = my_function() # Cached for 3 days
Verify before relying
- Whether pickle serialization is safe for untrusted function return values or if there are known deserialization risks.
- Performance characteristics when caching large objects or handling concurrent access to the same cache files.
- Compatibility with modern Python versions beyond what the unspecified python_support indicates.
Package facts
| License | permissive license permissive |
| Python support | Not specified |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | None |
| Maintenance | Dormant 1,711 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 110,646 / month, #12,448 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | License :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3 |
Evidence: cache_to_disk-2.0.0-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “disk caching decorator”
- cache-to-diskA decorator that caches function results to disk with pickle…
- kleptoklepto provides multiple caching algorithms (LRU, LFU, MRU,…
- shelved-cacheWraps cachetools cache implementations with disk persistence,…
Give your agent the search over MCP, or paste the wish link into any chat.
More Software Development packages
Provides backported and experimental type hints for Python 3.9+, allowing use of newer typing features on older Python versions and enabling early experimentation with type system PEPs before they enter the standard library.
NumPy provides an N-dimensional array object and a comprehensive suite of mathematical, linear algebra, Fourier transform, and random number functions for scientific computing in Python.
FastAPI is a Python web framework for building REST APIs using type hints, with automatic request validation, serialization, and interactive API documentation.
Provides a way to document function parameters, class attributes, return types, and variables inline using Python's `Annotated` type hint syntax instead of traditional docstrings.
Typer builds command-line applications from Python functions using type hints, automatically generating help text, argument parsing, and shell completion.
Install it if you are building CLIs in Python.
Distlib provides low-level packaging utilities for building, distributing, and managing Python software—including metadata handling, version specifiers, wheel support, script installation, and dependency resolution.
See also cachier · shelved-cache · klepto · django-memoize · expiringdict · memoization · cached_method · onecache · flexcache · diskcache