Skip to main content

recall

Smart caching for any function — simple as requests.

from recall import cache

@cache(ttl="1h")
def get_user(user_id):
    return db.query(user_id)

Features

  • Simple API — just @cache(ttl="1h") on any function
  • Multiple backends — Memory, Disk, Redis
  • TTL shorthand — "30m", "1h", "7d" instead of raw seconds
  • LRU eviction — automatic cleanup when maxsize is reached
  • Thread-safe — works in concurrent environments
  • Zero dependencies — Redis backend optional

Install

pip install recall
# With Redis support:
pip install recall[redis]

Quick Start

from recall import cache
import time

@cache(ttl="1h", maxsize=1000)
def expensive_func(x):
    time.sleep(2)
    return x * 2

# First call: computes
result = expensive_func(5)  # takes 2 seconds

# Second call: instant (from cache)
result = expensive_func(5)  # returns immediately

Backends

Memory (default)

@cache(ttl="1h", maxsize=1000)
def func(x):
    return x * 2

Disk (persistent)

from recall import DiskBackend

@cache(ttl="1h", backend=DiskBackend("/tmp/my_cache"))
def func(x):
    return x * 2

Redis

from recall import RedisBackend

@cache(ttl="1h", backend=RedisBackend("redis://localhost:6379"))
def func(x):
    return x * 2

Cache Management

# Clear all cached values
expensive_func.cache_clear()

# Delete specific key
expensive_func.cache_delete(42)

# Custom key function
@cache(ttl="1h", key_fn=lambda f, a, k: f"{a}_{k.get('mode', '')}")
def custom(data, mode):
    return f"{data}_{mode}"

TTL Formats

Shorthand Meaning
"30s" 30 seconds
"5m" 5 minutes
"1h" 1 hour
"1d" 1 day
"1w" 1 week
3600 raw seconds (int/float)

Why recall?

Tool Issue
functools.lru_cache No TTL, no persistence
cachetools Complex API, no disk/Redis
redis alone Manual key management
dogpile.cache Overkill for simple use

recall = simple API + real backends + TTL done right.

License

MIT

trigger

trigger

trigger

trigger

trigger

Release files for recall-cache 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for recall-cache 0.2.0
File Size Uploaded
recall_cache-0.2.0.tar.gz 8.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for recall-cache 0.2.0
File Interpreter ABI Platform
recall_cache-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 13.4 kB

Release files / recall_cache-0.2.0.tar.gz

Download URL recall_cache-0.2.0.tar.gz
Size 8.1 kB
Tags Source
SHA-256 checksum
How to use checksums
e228a43ea3c7d2d394023bb2acd5a7b23049416708462b0ab6c9e38fef729667
BLAKE2b-256 checksum
How to use checksums
a6ab94cb6b8d75101239c7934019e17bba5c86a7f3c7610f4f843f868a15a8a0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 11, 2026.

Transparency log

Release files / recall_cache-0.2.0-py3-none-any.whl

Download URL recall_cache-0.2.0-py3-none-any.whl
Size 5.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
de47c45a16770cdb47a727dacb99ddde5d9d42c04159936666301001bc02e193
BLAKE2b-256 checksum
How to use checksums
58ac8b36a2d9116a2c3d0567255083e8896cdeefb9c3e59f99b84d8d80ca7314
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 11, 2026.

Transparency log

Release history Release notifications | RSS feed

3.1.0

2 release files

2.0.0

2 release files

1.0.0

2 release files

0.6.0

2 release files

0.4.0

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

This release

0.2.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page