Skip to main content

Persistent cache for expensive functions

Project description

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

Project details


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.1.1.tar.gz (9.4 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.1.1-py3-none-any.whl (12.0 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for persistent_function_cache-0.1.1.tar.gz
Algorithm Hash digest
SHA256 c08988df7afac034026751d601d811684e3afdb115c02b3980b843ed19fda79d
MD5 6b2e23f188edc5e3f67df798b1cbc70c
BLAKE2b-256 dd78009245c6a7e2a6af49fa42f20a5c0cc6160f80c7a7a3acc697124421edc5

See more details on using hashes here.

Provenance

The following attestation bundles were made for persistent_function_cache-0.1.1.tar.gz:

Publisher: build.yml on quintenroets/persistent-cache

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

File hashes

Hashes for persistent_function_cache-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8eeeefa0b69b49aaeab522b6c6ce83e7f951cfcadb2b5ff1ddb7dd872d1c1c77
MD5 0c38a03116d03fe5e692a0497d330754
BLAKE2b-256 bb13518c81c21341b0499df3655b2336b571802f217e7834f528c8465332b0bc

See more details on using hashes here.

Provenance

The following attestation bundles were made for persistent_function_cache-0.1.1-py3-none-any.whl:

Publisher: build.yml on quintenroets/persistent-cache

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page