$npx skillfedfor your agent

cachetools

Extensible memoizing collections and decorators

Worth itPyPI Python ModulesReleased Aug 2026345.3M downloads / moMITPure Python

Decision gist · record as of 2026-08-14

pure-Python wheel — cachetools-7.1.7-py3-none-any.whl
v7.1.7 · released 2026-08-01 · Python >=3.10

Yes. cachetools is a mature, actively maintained library with no dependencies, permissive licensing, and strong adoption. Install it if you need caching beyond what functools.lru_cache offers—particularly for TTL expiration, custom eviction policies, or fine-grained cache control. The low friction and zero security issues make it a safe, practical choice.AI-flagged interpretation of the facts on this page — verify before relying

Before you install

  • Requires Python 3.10 or later.
  • Installation is straightforward with no runtime dependencies and a pure-Python wheel distribution.
  • The project is actively maintained with a recent release and shows strong community adoption.

License · maintenance · safety

MIT (permissive) — MIT license permits unrestricted use, modification, and distribution in both open-source and commercial projects with minimal obligations.

last release 2026-08-01 (13 days) · last repo commit 2026-08-01 · 2,776 stars

0 known vulnerabilities (OSV.dev, 2026-08-14) · 345,317,933 downloads/mo, #119 on PyPI

Verify before relying

pip install cachetools

from cachetools import cached, LRUCache

@cached(cache=LRUCache(maxsize=32))
def expensive_function(n):
    return n * 2
  • Performance characteristics and memory overhead compared to functools.lru_cache for typical workloads.
  • Thread-safety guarantees for concurrent access to cache instances.
  • Behavior when cache keys are unhashable or mutable objects.
Same gist for agents: .md · .json

What it is and what it does

cachetools is a Python library that provides memoizing collections and decorators for caching function results with pluggable eviction strategies. It extends the capabilities of the standard library's @lru_cache by offering multiple cache implementations—LRU (least recently used), TTL (time-to-live), FIFO, and others—allowing you to choose the right cache behavior for your use case. You decorate a function with @cached and pass a cache instance, and the library handles storing and retrieving results automatically.

The library is designed for scenarios where you need fine-grained control over cache behavior: limiting memory use with a maximum size, expiring cached data after a time window, or using alternative eviction policies. It has no external runtime dependencies, installs cleanly, and supports modern Python versions. It's commonly used in web applications, data processing pipelines, and any code path where repeated computation of the same inputs is expensive.

Use it for

  • Speed up recursive algorithms like Fibonacci by caching intermediate results with @cached decorator.
  • Cache API responses or database queries with TTLCache to refresh data periodically without manual invalidation.
  • Implement a bounded memory cache for expensive computations using LRUCache with a fixed maxsize.
  • Replace functools.lru_cache when you need custom eviction policies or time-based expiration.
  • Build multi-tier caching in data pipelines where different functions need different cache strategies.

Worth the install?

AI-flagged interpretation of the facts on this page. Verify before relying on it.

Worth it

Yes.

cachetools is a mature, actively maintained library with no dependencies, permissive licensing, and strong adoption. Install it if you need caching beyond what functools.lru_cache offers—particularly for TTL expiration, custom eviction policies, or fine-grained cache control. The low friction and zero security issues make it a safe, practical choice.

Install

cachetools on PyPI

Before you install

Installation is straightforward with no runtime dependencies and a pure-Python wheel distribution. The project is actively maintained with a recent release and shows strong community adoption.

Requires Python 3.10 or later.

License in practice

MIT license permits unrestricted use, modification, and distribution in both open-source and commercial projects with minimal obligations.

Quickstart

pip install cachetools

from cachetools import cached, LRUCache

@cached(cache=LRUCache(maxsize=32))
def expensive_function(n):
    return n * 2

Verify before relying

  • Performance characteristics and memory overhead compared to functools.lru_cache for typical workloads.
  • Thread-safety guarantees for concurrent access to cache instances.
  • Behavior when cache keys are unhashable or mutable objects.

Package facts

LicenseMIT permissive
Python supportSupports the current Python release >=3.10
Install frictionLow. Pure-Python wheel
Runtime dependenciesNone
MaintenanceActively maintained 13 days since the last release
Last repo commit
First released
Downloads345,317,933 / month, #119 on PyPI 30-day window, as of 2026-08-14
Known vulnerabilitiesNone known OSV.dev, checked 2026-08-14
Classifiers
Development Status :: 5 - Production/StableIntended Audience :: DevelopersOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Topic :: Software Development :: Libraries :: Python Modules

Evidence: cachetools-7.1.7-py3-none-any.whl

Tags

Capabilities
function memoization decoratorLRU cache implementationTTL cache with expirationcaching with eviction policymemoizing collectionsfunction result cachingcache algorithm library
Topics
memoizationperformance-optimizationcaching

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 › “memoizing collections”

  • cachetoolsProvides memoizing collections and function decorators for caching…
  • cacheboxCachebox is a high-performance in-memory caching library written in…
  • CFGraphCFGraph extends rdflib's Graph to read RDF collections as flattened…

Give your agent the search over MCP, or paste the wish link into any chat.

More Python Modules packages

idna Worth it
PyPI · Python Modules · released Jun 2026

Converts domain names between Unicode and ASCII-compatible encoding (Punycode) according to IDNA 2008 and Unicode Technical Standard 46, with security validation and broader script coverage than the standard library.

Install it if you work with internationalized domain names, need to validate domains, or use HTTP clients that depend on it transitively.

BSD-3-Clausepure Python · 3.9+
1.8Bdownloads / mo
setuptools Worth it
PyPI · Python Modules · released Aug 2026

Setuptools is a Python build backend and package management tool that handles building, distributing, and installing Python packages, including support for C/C++ extension modules.

MITpure Python · 3.10+
1.6Bdownloads / mo
PyYAML Worth it
PyPI · Python Modules · released Sep 2025

PyYAML parses and emits YAML 1.1 data format, enabling serialization and deserialization of configuration files and Python objects to and from human-readable YAML text.

MITcompiled wheel · 3.8+
1.2Bdownloads / mo
pydantic Worth it
PyPI · Python Modules · released May 2026

Pydantic validates Python data structures against type hints, coercing and checking input at runtime to ensure it matches a declared schema.

MITpure Python · 3.9+
1.1Bdownloads / mo
annotated-types Worth it
PyPI · Python Modules · released Jul 2026

Provides reusable metadata objects for use with PEP-593 `typing.Annotated` to express common constraints like bounds, collection sizes, and predicates on types.

Install it if you use or build libraries that need to express type constraints in a standardized, inspectable way—or if you want to annotate your own types with…

MITpure Python · 3.10+
871.3Mdownloads / mo
typing-inspection Worth it
PyPI · Python Modules · released Aug 2026

Provides runtime tools to inspect and introspect Python type annotations, enabling programmatic examination of type hints at execution time.

MITpure Python · 3.10+
783.0Mdownloads / mo

See also memoization · shelved-cache · pylru · methodtools · asyncache · cachebox · cachetools-async · onecache · klepto · functools32