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.2.0.tar.gz (9.8 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.2.0-py3-none-any.whl (12.1 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for persistent_function_cache-0.2.0.tar.gz
Algorithm Hash digest
SHA256 154e2dd8d829d8b1d67dd73eba75ac7e3137d720cd4a3e042dd9e111390d91c7
MD5 61ac84478ec327805b06710a1ca6775b
BLAKE2b-256 4f42826857a3d1bd94a7dc9114f79ed9bbd0c8d96a56083ce00b44c63f39d33d

See more details on using hashes here.

Provenance

The following attestation bundles were made for persistent_function_cache-0.2.0.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.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for persistent_function_cache-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c578ffd9e3112f2d2f12430772f17db58f522b14f729f9034d50226d61bbb415
MD5 4750e61af0acfe95793e77f6847b5a40
BLAKE2b-256 6cbfe35a6c4df73b2590af6f2fc1b24f1d106f926d6bcf721eccb0347fb62314

See more details on using hashes here.

Provenance

The following attestation bundles were made for persistent_function_cache-0.2.0-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