cached_method
The equivalent of cached_property for methods
Decision gist · record as of 2026-08-14
Yes, if you need per-instance method caching for non-hashable classes or resource-intensive objects. The code is simple and stable, but be aware the package is unmaintained since 2021-10-31—verify compatibility with your Python version before relying on it in production. For small hashable objects where global caching is acceptable, the standard functools approach may be preferable.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python >= 3.6.
- Low install friction with no runtime dependencies.
- However, the package is abandoned—last release was 2021-10-31 with no updates since, though the repository remains public and the code is stable.
License · maintenance · safety
permissive license (permissive) — Licensed under MIT (permissive), so you may use, modify, and distribute freely with minimal restrictions.
last release 2021-10-31 (1748 days) · last repo commit 2021-10-31 · 11 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 77,437 downloads/mo, #14,524 on PyPI
Alternatives
Verify before relying
from cached_method import cached_method
class Example:
@cached_method(maxsize=2)
def expensive_method(self, arg):
return arg * 2
obj = Example()
result = obj.expensive_method(arg)- Whether the package works correctly with modern Python versions despite being unmaintained since 2021.
- Performance characteristics compared to functools.lru_cache in typical use cases.
- Thread-safety guarantees when methods are called concurrently with identical arguments.
What it is and what it does
cached_method is a decorator that caches method results on a per-instance basis, similar to functools.cached_property but for methods with arguments. Unlike functools.lru_cache applied directly to methods, it does not require the containing class to be hashable, and it does not maintain a global cache that extends object lifetimes. This is particularly useful for classes managing scarce resources like GPU memory, where you want objects and their caches to be garbage-collected together.
The decorator closely mirrors functools.cached_property's implementation but omits internal locking, accepting the possibility of redundant method calls in multi-threaded contexts when equivalent arguments are used simultaneously. It also supports caching expensive operations like __hash__ without requiring the object itself to be hashable for cache lookups.
Use it for
- Cache expensive GPU operations in tensor-based classes where immediate garbage collection matters.
- Memoize method results for non-hashable objects without polluting a global cache.
- Cache __hash__ computations for objects that perform costly transfers between devices.
- Reduce redundant computation in methods called repeatedly with the same arguments within an instance.
- Manage memory-intensive resources that should be freed when their owning object is deleted.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you need per-instance method caching for non-hashable classes or resource-intensive objects.
The code is simple and stable, but be aware the package is unmaintained since 2021-10-31—verify compatibility with your Python version before relying on it in production. For small hashable objects where global caching is acceptable, the standard functools approach may be preferable.
Install
cached-method on PyPI
Before you install
Low install friction with no runtime dependencies. However, the package is abandoned—last release was 2021-10-31 with no updates since, though the repository remains public and the code is stable.
Requires Python >= 3.6.
License in practice
Licensed under MIT (permissive), so you may use, modify, and distribute freely with minimal restrictions.
Quickstart
from cached_method import cached_method
class Example:
@cached_method(maxsize=2)
def expensive_method(self, arg):
return arg * 2
obj = Example()
result = obj.expensive_method(arg)
Verify before relying
- Whether the package works correctly with modern Python versions despite being unmaintained since 2021.
- Performance characteristics compared to functools.lru_cache in typical use cases.
- Thread-safety guarantees when methods are called concurrently with identical arguments.
Package facts
| License | permissive license permissive |
| Python support | Supports the current Python release >= 3.6 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | None |
| Maintenance | Abandoned 1,748 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 77,437 / month, #14,524 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 LicenseOperating System :: OS IndependentProgramming Language :: Python |
Evidence: cached_method-0.1.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 › “per-instance cache decorator”
- cached_methodProvides a method-level caching decorator that stores results per…
- django-cache-memoizeA decorator that caches function results using Django's cache…
- cachettlcachettl provides LRU TTL cache decorators for both synchronous and…
Give your agent the search over MCP, or paste the wish link into any chat.
More Software Development packages
Provides backported and experimental type hints for Python 3.9+, allowing use of newer typing features on older Python versions and enabling early experimentation with type system PEPs before they enter the standard library.
NumPy provides an N-dimensional array object and a comprehensive suite of mathematical, linear algebra, Fourier transform, and random number functions for scientific computing in Python.
FastAPI is a Python web framework for building REST APIs using type hints, with automatic request validation, serialization, and interactive API documentation.
Provides a way to document function parameters, class attributes, return types, and variables inline using Python's `Annotated` type hint syntax instead of traditional docstrings.
Typer builds command-line applications from Python functions using type hints, automatically generating help text, argument parsing, and shell completion.
Install it if you are building CLIs in Python.
Distlib provides low-level packaging utilities for building, distributing, and managing Python software—including metadata handling, version specifiers, wheel support, script installation, and dependency resolution.
See also propcache · methodtools · memoization · backports.cached-property · django-memoize · cachier · django-cache-memoize · cache-to-disk · klepto · weakrefmethod