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.0.tar.gz (9.0 kB view details)

Uploaded Source

Built Distribution

persistent_function_cache-0.1.0-py3-none-any.whl (11.4 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for persistent_function_cache-0.1.0.tar.gz
Algorithm Hash digest
SHA256 870ad0050a1be3ac4c23f00e5a429e80d3dd2f5886bfc6c9a549af499017421b
MD5 3f5e874dede775816d53ba991b797ee1
BLAKE2b-256 93c08eb1f8e2adc943f1aa0da558f65fc6ebfb6052563554efe16ae4924cba68

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for persistent_function_cache-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bb9338376ce1436d741be8d4e3fb78f4733aee33a2465394bd7135a83141333b
MD5 f74a0e44e2056be168d738bb14aca10c
BLAKE2b-256 efbd1be3d0c74b286700a44a8e9ba8525944d1223122a26c91425d2b2390bbc6

See more details on using hashes here.

Supported by

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