theine
high performance in-memory cache
Decision gist · record as of 2026-08-14
Yes, if you need a performant, thread-safe in-memory cache with minimal setup. The low install friction, permissive license, and lack of known vulnerabilities make it a safe choice. However, the aging maintenance status (362 days since last release) means you should verify that its feature set and performance characteristics match your workload before committing to production use.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.9 or later; free-threaded Python 3.13.6+ is recommended for best results with free-threading.
- Low install friction with a pure wheel distribution.
- Maintenance status is aging—last release was 362 days ago—but the package remains functional and receives updates.
License · maintenance · safety
BSD-3-Clause (permissive) — BSD-3-Clause is permissive; you may use, modify, and distribute Theine freely in commercial and private projects provided you include the license notice.
last release 2025-08-17 (362 days)
0 known vulnerabilities (OSV.dev, 2026-08-14) · 144,330 downloads/mo, #11,154 on PyPI
Alternatives
Verify before relying
pip install theine
from theine import Cache
from datetime import timedelta
cache = Cache(10000)
cache.set("key", {"foo": "bar"}, timedelta(seconds=100))
v, ok = cache.get("key")
if ok:
print(v)- Whether the Rust core dependency (theine-core) is pre-built for all major platforms or requires compilation.
- Performance benchmarks against other Python caching libraries in typical production workloads.
- Whether the single shared expiration thread scales well with thousands of cache instances.
What it is and what it does
Theine is an in-memory cache library for Python with a Rust-based core that implements an adaptive W-TinyLFU eviction policy. It stores key-value pairs in memory and automatically removes expired entries using a hierarchical timer wheel. The cache is fully typed, thread-safe by default, and supports free-threading in Python 3.13.6+.
The library provides both a direct Cache API for manual caching and a Memoize decorator for function result caching. It supports both synchronous and asynchronous functions, offers cache stampede protection, and includes a Django cache backend. Version 2.0 simplified the API by consolidating to a single eviction policy, changing Cache.get to return an explicit (value, exists) tuple, and renaming the timeout parameter to ttl.
Use it for
- Cache expensive database queries or API responses in web applications to reduce latency and load.
- Memoize function results in data processing pipelines to avoid redundant computation.
- Store session data or temporary state in multi-threaded Python services with automatic expiration.
- Use as a Django cache backend for application-level caching without external infrastructure.
- Accelerate machine learning inference by caching model predictions or intermediate results.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you need a performant, thread-safe in-memory cache with minimal setup.
The low install friction, permissive license, and lack of known vulnerabilities make it a safe choice. However, the aging maintenance status (362 days since last release) means you should verify that its feature set and performance characteristics match your workload before committing to production use.
Install
theine on PyPI
Before you install
Low install friction with a pure wheel distribution. Maintenance status is aging—last release was 362 days ago—but the package remains functional and receives updates.
Requires Python 3.9 or later; free-threaded Python 3.13.6+ is recommended for best results with free-threading.
License in practice
BSD-3-Clause is permissive; you may use, modify, and distribute Theine freely in commercial and private projects provided you include the license notice.
Quickstart
pip install theine
from theine import Cache
from datetime import timedelta
cache = Cache(10000)
cache.set("key", {"foo": "bar"}, timedelta(seconds=100))
v, ok = cache.get("key")
if ok:
print(v)
Verify before relying
- Whether the Rust core dependency (theine-core) is pre-built for all major platforms or requires compilation.
- Performance benchmarks against other Python caching libraries in typical production workloads.
- Whether the single shared expiration thread scales well with thousands of cache instances.
Package facts
| License | BSD-3-Clause permissive |
| Python support | Supports the current Python release <4.0,>=3.9 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 3 packagestheine-coretyping-extensionszstandard |
| Maintenance | Aging 362 days since the last release |
| First released | |
| Downloads | 144,330 / month, #11,154 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Programming Language :: Python :: 3Topic :: Software Development :: LibrariesTopic :: Software Development :: Libraries :: Python Modules |
Evidence: theine-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 › “high performance caching”
- theineTheine is a high-performance in-memory cache with a Rust core,…
- jiterA fast JSON parser that converts bytes into Python objects, offering…
- cached-ipaddressCaches IP address object construction and property lookups to avoid…
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 cacheout · async-cache · memoization · cachebox · repoze-lru · cachetools · asyncache · async-lru · aiocache · onecache