skillfed

cachetools

Extensible memoizing collections and decorators

cachetools Permissive license MIT Active 2,776 v7.1.7 released

Install

cachetools on PyPI

pip

pip install cachetools

uv

uv add cachetools

poetry

poetry add cachetools

Package facts

License MIT (permissive)
Python support supports the current Python release (>=3.10)
Install friction low — pure-Python wheel
Runtime dependencies none
Maintenance actively maintained — 12 days since the last release
Last repo commit
First released
Popularity one of the top 1,000 most-downloaded packages on PyPI (30-day window, as of 2026-08-13)
Known vulnerabilities none known (OSV.dev, checked 2026-08-13)

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

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

About cachetools

from the package's own PyPI description — quoted content, verbatim

cachetools

.. image:: https://img.shields.io/pypi/v/cachetools :target: https://pypi.org/project/cachetools/ :alt: Latest PyPI version

.. image:: https://img.shields.io/github/actions/workflow/status/tkem/cachetools/ci.yml :target: https://github.com/tkem/cachetools/actions/workflows/ci.yml :alt: CI build status

.. image:: https://img.shields.io/readthedocs/cachetools :target: https://cachetools.readthedocs.io/ :alt: Documentation build status

.. image:: https://img.shields.io/codecov/c/github/tkem/cachetools/master.svg :target: https://codecov.io/gh/tkem/cachetools :alt: Test coverage

.. image:: https://img.shields.io/github/license/tkem/cachetools :target: https://raw.github.com/tkem/cachetools/master/LICENSE :alt: License

This module provides various memoizing collections and decorators, including variants of the Python Standard Library's @lru_cache_ function decorator.

.. code-block:: python

from cachetools import cached, LRUCache, TTLCache

# speed up calculating Fibonacci numbers with dynamic programming @cached(cache={}) def fib(n): return n...

Read as markdown · JSON record · Source repository · Homepage · Docs

AI interpretation — verify before relying

AI-generated interpretation of the package facts above; every digit, version, license, or vulnerability id it cites is grounded in the facts already shown on this page

Provides memoizing collections and decorators for caching function results with multiple cache algorithms (LRU, TTL, FIFO) and eviction strategies, similar to Python's standard library @lru_cache but with more flexibility.

Installation is straightforward with no runtime dependencies and a pure-Python wheel distribution. The project is actively maintained with a recent release (12 days old) and strong community engagement (2776 GitHub stars).

Licensed under MIT (permissive), allowing unrestricted use, modification, and distribution in both open-source and commercial projects with only attribution required.

Usage

pip install cachetools

from cachetools import cached, LRUCache

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

result = expensive_function(5)

Requires Python 3.10 or later.

Verdict: cachetools is a mature, actively maintained caching library with zero known vulnerabilities, no external dependencies, and permissive MIT licensing. It offers production-ready cache implementations with multiple eviction strategies and is well-suited for performance optimization in Python applications.

Needs verification

  • Whether TTLCache and other advanced cache types require additional setup or configuration beyond basic decorator usage.
  • Performance characteristics and memory overhead compared to the standard library's functools.lru_cache for typical workloads.
function memoization decoratorLRU cache implementationTTL cache with expirationcaching decorator librarymemoizing collections pythonfunction result cachingcache algorithm implementations

Similar packages