cachier
Persistent, stale-free, local and cross-machine caching for Python functions.
Decision gist · record as of 2026-08-14
Yes. Cachier is actively maintained, has low install friction, carries no known vulnerabilities, and solves a common problem (avoiding redundant expensive function calls) with a simple decorator API. The MIT license is permissive. Choose it if you need persistent caching with expiry and backend flexibility; skip it if you only need transient in-memory caching (use functools.lru_cache instead).AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.10 or later.
- Function arguments must be hashable (immutable built-in types); custom objects or mutable containers need a custom hash_func.
- Low friction: pure Python wheel with three lightweight runtime dependencies (portalocker, pympler, watchdog).
License · maintenance · safety
permissive license (permissive) — MIT License (permissive): you can use, modify, and distribute cachier freely in commercial and private projects with minimal restrictions, provided you include the original copyright notice.
last release 2026-03-26 (141 days) · last repo commit 2026-08-01 · 661 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 156,308 downloads/mo, #10,788 on PyPI
Alternatives
Verify before relying
pip install cachier
from cachier import cachier
import datetime
@cachier(stale_after=datetime.timedelta(days=3))
def expensive_function(arg1, arg2):
return {'arg1': arg1, 'arg2': arg2}
result = expensive_function('x', 'y') # cached for 3 days- Overhead claim of 'around 1 millisecond' per call—actual performance impact depends on backend and system load.
- Thread-safety guarantees across all supported backends—documentation does not detail concurrency behavior for each backend.
- Memory core backend performance and limits under high-volume caching scenarios.
What it is and what it does
Cachier wraps Python functions with a decorator that persists their return values across program runs, avoiding redundant computation. It stores cached results using pluggable backends—pickle files by default, but also MongoDB, SQL databases, Redis, S3, or in-memory storage—and automatically invalidates stale entries based on a configurable time window. You can set per-function expiry times, trigger background recalculation of stale values without blocking, and globally enable or disable caching.
The package is designed for functions that take more than a second to execute; it adds roughly 1 millisecond of overhead per call. It handles both sync and async functions, supports thread-safe operation, and works across different Python sessions and machines (when using appropriate backends). Arguments must be hashable or you must provide a custom hash function. Instance methods are cached globally across all object instances, which can be a gotcha if methods depend on instance state.
Use it for
- Cache expensive API calls or database queries with automatic expiry to balance freshness and performance.
- Avoid recomputing long-running data transformations or ML model inference across multiple script runs.
- Share cached results across different machines or processes using MongoDB, Redis, or S3 backends.
- Implement fuzzy refresh: return stale cached values immediately while recalculating in the background.
- Automatically clean up old cache entries on a schedule to prevent unbounded storage growth.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
Cachier is actively maintained, has low install friction, carries no known vulnerabilities, and solves a common problem (avoiding redundant expensive function calls) with a simple decorator API. The MIT license is permissive. Choose it if you need persistent caching with expiry and backend flexibility; skip it if you only need transient in-memory caching (use functools.lru_cache instead).
Install
cachier on PyPI
Before you install
Low friction: pure Python wheel with three lightweight runtime dependencies (portalocker, pympler, watchdog). Active maintenance with recent commits and 661 repository stars. Requires Python 3.10+.
Requires Python 3.10 or later. Function arguments must be hashable (immutable built-in types); custom objects or mutable containers need a custom hash_func.
License in practice
MIT License (permissive): you can use, modify, and distribute cachier freely in commercial and private projects with minimal restrictions, provided you include the original copyright notice.
Quickstart
pip install cachier
from cachier import cachier
import datetime
@cachier(stale_after=datetime.timedelta(days=3))
def expensive_function(arg1, arg2):
return {'arg1': arg1, 'arg2': arg2}
result = expensive_function('x', 'y') # cached for 3 days
Verify before relying
- Overhead claim of 'around 1 millisecond' per call—actual performance impact depends on backend and system load.
- Thread-safety guarantees across all supported backends—documentation does not detail concurrency behavior for each backend.
- Memory core backend performance and limits under high-volume caching scenarios.
Package facts
| License | permissive license permissive |
| Python support | Supports the current Python release >=3.10 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 3 packagesportalockerpymplerwatchdog |
| Maintenance | Actively maintained 141 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 156,308 / month, #10,788 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 4 - BetaIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseProgramming Language :: PythonProgramming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Topic :: Other/Nonlisted TopicTopic :: Software Development :: LibrariesTopic :: Software Development :: Libraries :: Python ModulesTopic :: Utilities |
Evidence: cachier-4.2.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 › “persistent memoization with expiry”
- cachierCachier is a decorator that adds persistent, expiring caching to…
- cachettlcachettl provides LRU TTL cache decorators for both synchronous and…
- kleptoklepto provides multiple caching algorithms (LRU, LFU, MRU,…
Give your agent the search over MCP, or paste the wish link into any chat.
More Libraries packages
urllib3 is an HTTP client library that provides thread-safe connection pooling, SSL/TLS verification, multipart file uploads, request retries, compression support, and proxy handling for Python applications.
Requests is a Python HTTP library that simplifies sending HTTP/1.1 requests with automatic handling of headers, authentication, cookies, and response parsing.
Pluggy provides a plugin system that lets you define hook specifications and register implementations to be called in sequence, enabling extensible Python applications without tight coupling.
Install it if you're building an extensible application or framework.
Provides parsing, arithmetic, and recurrence rule computation for dates and times, with timezone support and iCalendar RFC compliance.
Install it if you need to parse flexible date strings, compute relative dates, handle timezones, or work with recurrence rules—it's the de facto choice for these tasks.
Six provides utility functions to write Python code that runs on both Python 2.7 and Python 3.3+, smoothing over language differences between the two versions.
pytest is a testing framework that lets you write test functions using plain assert statements and automatically discovers and runs them, with detailed failure reporting.
See also cache-to-disk · python-redis-cache · memoization · cached_method · cachetools · django-cache-memoize · klepto · zope.cachedescriptors · jiter · aiohttp-client-cache