Skip to main content

ttl-cache

How to use it

pip install ttl-cache
import ttl_cache


# use ttl_cache directly
@ttl_cache
def expensive_operation(a, b):
    ...
    ...
    return SOME_RESULT

expensive_operation(xx, yy)
expensive_operation(xx, yy)  # prefer cached result
# ... 60 seconds later
expensive_operation(xx, yy)  # compute again


# or
@ttl_cache(2.0)  # cache the result in the next 2 seconds, default is 60.0 seconds
def expensive_operation(a, b):
    ...
    ...

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ttl-cache-1.6.tar.gz (2.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ttl_cache-1.6-py3-none-any.whl (2.4 kB view details)

Uploaded Python 3

File details

Details for the file ttl-cache-1.6.tar.gz.

File metadata

  • Download URL: ttl-cache-1.6.tar.gz
  • Upload date:
  • Size: 2.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.3

File hashes

Hashes for ttl-cache-1.6.tar.gz
Algorithm Hash digest
SHA256 c4ce4af36d43aba549a357ab317a6191439d3b47bee166ef67b1d6b07a3effb5
MD5 87aebe4ef5a9de0958a01bb5687f759a
BLAKE2b-256 7944a78cecc906fd5b685727b1ad1b34193b93d66867261f3e68911a9f98b2d4

See more details on using hashes here.

File details

Details for the file ttl_cache-1.6-py3-none-any.whl.

File metadata

  • Download URL: ttl_cache-1.6-py3-none-any.whl
  • Upload date:
  • Size: 2.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.3

File hashes

Hashes for ttl_cache-1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 061f30074480c4f9efd6e65a94f8b39dbe8e3c4e7aa330771233b29bae5e813f
MD5 cfade4e31a849c6f542a672c7248965b
BLAKE2b-256 b768237ea3d3430655cd965c8b9852dcd133d15201c5ee6a07bb2247d43a5ec4

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

1.6 This release

2 files

1.5

1 file

1.4

1 file

1.3

1 file

1.2

1 file

1.1

1 file

1.0

1 file

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