Skip to main content

Cache

PyPI version PyPI downloads Python version Operating system Coverage

Usage

Use

from persistent_cache import cache

@cache
def expensive_function(..):
    ..

to cache the result of a function

The cache key for the result is determined by:

  • the function signature
  • the implementation of the function
  • the values of the function arguments
    • custom transformations/reductions can be specified

Advantages compared to existing solutions:

  • the cache in invalidated when the behavior of the function changes
  • Each cache value is saved to a separate location. Only values that are effectively needed are loaded.
  • works with function arguments of any complex data type.
  • configurable: custom transformations/reductions can be specified based on the object type.
  • 3 custom transformation groups available out-of-the-box:
    • from persistent_cache import cache
    • from persistent_cache.caches.deep_learning import cache
    • from persistent_cache.caches.speedup_deep_learning import cache`

Installation

pip install persistent-function-cache

Download files

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

Source Distribution

persistent_function_cache-0.3.0.tar.gz (10.0 kB view details)

Uploaded Source

Built Distribution

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

persistent_function_cache-0.3.0-py3-none-any.whl (11.8 kB view details)

Uploaded Python 3

File details

Details for the file persistent_function_cache-0.3.0.tar.gz.

File metadata

  • Download URL: persistent_function_cache-0.3.0.tar.gz
  • Upload date:
  • Size: 10.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for persistent_function_cache-0.3.0.tar.gz
Algorithm Hash digest
SHA256 c3dc71eb0270975bda645147f2b25d514306a3f77d2fb0cf11a49389cd4fa117
MD5 e647c09ae05db5b507d6248d02d0bf6e
BLAKE2b-256 d30d61f86a19cea46cac4292acf327b3b7832c952c6c6b4349aa9e7a878615c7

See more details on using hashes here.

File details

Details for the file persistent_function_cache-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: persistent_function_cache-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 11.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for persistent_function_cache-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b9a772b308712296d465c2df43d4caa7ce2094d4ebb591bc2c7951896efc92af
MD5 931bbe70ce370ff2cfd383a558adb7f9
BLAKE2b-256 8d302cbffb7084b852a7e88f597968297ccc122357717738873b67ac8d686177

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 files

0.2.2

2 files

0.2.1

2 files

0.2.0

2 files

0.1.1

2 files

0.1.0

2 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