tkem

tkem/cachetools

Python MIT Dev Tools

Extensible memoizing collections and decorators

2.8k stars
197 forks
active
GitHub +6 / week

2.8k

Stars

197

Forks

2

Open issues

21

Contributors

AI Analysis

cachetools provides extensible memoizing collections and decorators for Python, including LRU, TTL, and other cache implementations that mimic the standard library's @lru_cache. It is purpose-built for developers who need flexible, production-grade caching beyond the built-in options, and benefits anyone building performance-critical Python applications requiring fine-grained cache control.

Dev Tools Library Discovery value: 4/10
Documentation 9/10
Activity 9/10
Community 8/10
Code quality 8/10

Inferred from signals mentioned in the README (tests, CI, type safety) — not a review of the actual code.

Overall score 8/10

AI's overall editorial judgment — not an average of the bars above, can weigh other factors too.

caching memoization performance-optimization decorators python-stdlib
Actively maintained Well documented MIT licensed Niche/specialized use case Beginner friendly Production ready
Deep Analysis · Based on README and public signals
2d ago

Lightweight Python memoization with pluggable cache algorithms; 12-year-old stable library for function caching.

cachetools provides in-memory caching decorators and collections for Python, offering LRU, LFU, TTL, and custom cache algorithms. Used in applications requiring function memoization without external services. Maintains high code quality and regular updates but serves a narrow niche: local, non-distributed caching. Not a replacement for Redis/Memcached but fills a gap between standard library @lru_cache and production-grade distributed systems.

Origin

Created in 2014 by Thomas Kemmer as a batteries-included caching toolkit. Has remained actively maintained for 12 years with consistent minor releases. Positioned as an extension to Python's functools.lru_cache with additional algorithms and flexibility.

Growth

Star count (2,760) is modest but stable relative to repository age and scope. Last 7-day gain of 5 stars suggests steady, marginal adoption rather than growth acceleration. Project appears to have reached equilibrium: solves a specific problem well, maintains a loyal user base, but does not experience viral adoption cycles typical of trendy frameworks.

In production

Adoption not verified through README. No case studies, user testimonials, or deployment metrics provided. Presence of satellite packages (asyncache, CacheToolsUtils, shelved-cache) suggests some ecosystem use, but scale unknown. PyPI availability confirms distribution capability; actual download/usage statistics not visible in metadata.

Code analysis
Architecture

Appears to be a collection of mutable mapping implementations (cache classes) plus decorator utilities. Based on README, provides LRUCache, LFUCache, TTLCache, and RRCache. Likely follows simple decorator pattern wrapping function calls with cache lookup logic. No framework or async runtime mentioned in core; async support referenced as separate packages (asyncache, cachetools-async).

Tests

README indicates codecov integration with badge; link provided to coverage report. Explicit mention of CI via GitHub Actions workflow. Suggests active testing discipline but coverage percentage not stated in README.

Maintenance

Last push 2026-07-02 (7 days before analysis date) indicates active maintenance. CI workflow badge present and documented. ReadTheDocs integration active. Copyright notice updated to 2026. No signs of abandonment; appears to receive regular minor updates and bug fixes.

Honest verdict

ADOPT IF: you need lightweight, in-process function memoization with custom eviction policies (TTL, LRU, LFU) and want to avoid external service dependencies or stdlib limitations. Suitable for single-service apps, microservices with local caching, or algorithms requiring custom cache backends. AVOID IF: you need distributed caching, persistent cache across process restarts, cache sharing across services, or high-performance networked caches — use Redis or Memcached instead. MONITOR IF: your application outgrows local caching needs or requires cache distribution; cachetools may become a bottleneck.

Independent dimensions

Mainstream potential

3/10

Technical importance

6/10

Adoption evidence

4/10

Risks
  • No distributed/shared cache support; scales only to single process memory.
  • In-memory only; all cached data lost on restart — not suitable for caches that must persist.
  • Adoption scale unclear from public data; unknown if widely used in production or niche tool.
  • Slow star growth and modest fork count suggest limited mindshare compared to stdlib alternatives.
  • Single maintainer (Thomas Kemmer) with no visible contributor team; bus factor may exist.
Prediction

Likely to remain a stable, specialized tool for local caching use cases. Unlikely to gain mainstream dominance due to stdlib competition and trend toward distributed systems. May see gradual decline relative to async-first frameworks if Python ecosystem shifts, but will persist as maintenance library.

0 found this helpful

Newsletter

Get analyses like this every Monday

Free weekly digest of the most interesting open-source discoveries.

Languages

Python
100%

Information

Language
Python
License
MIT
Last updated
3d ago
Created
150mo ago
Analyzed with
anthropic/claude-haiku-4-5

Stars over time

Loading…

Contributors over time

Top 100 contributors only — repos with more will plateau at 100.

Loading…

Recent releases

No releases published yet.

Similar repos

jaemk

jaemk/cached

cached provides thread-safe caching structures and function memoization macros...

2.1k Rust Dev Tools
whitfin

whitfin/cachex

Cachex is a high-performance in-memory caching library for Elixir that provides...

1.7k Elixir
epicweb-dev

epicweb-dev/cachified

Cachified is a TypeScript library that wraps cache storage backends (LRU,...

1.1k TypeScript Dev Tools
gordalina

gordalina/cachetool

CacheTool is a CLI utility and PHP library for managing APCu, OPcache, and file...

1.8k PHP DevOps
jellydator

jellydator/ttlcache

TTLCache is a thread-safe, in-memory cache library for Go with automatic item...

1.3k Go Dev Tools
vs. alternatives
functools.lru_cache (stdlib)

cachetools extends stdlib with additional eviction policies (TTL, LFU, RR) and mutable cache objects; stdlib version is simpler but lacks flexibility.

Redis + redislib

cachetools is local and in-process; Redis is distributed and persistent. Different use case: cachetools for single-process apps, Redis for multi-service architectures.

functools + diskcache

cachetools is memory-only; diskcache adds disk persistence. cachetools lighter-weight for ephemeral caches.

Memcached + pymemcache

Memcached is distributed and network-based; cachetools is local. Different deployment models.

Dogpile.cache

Dogpile offers distributed options and cache invalidation; cachetools is simpler and more minimal.