Metadata-Version: 2.2
Name: persistent-function-cache
Version: 0.1.1
Summary: Persistent cache for expensive functions
Author-email: Quinten Roets <qdr2104@columbia.edu>
License: MIT
Project-URL: Source Code, https://github.com/quintenroets/persistent-cache
Requires-Python: <3.13,>=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: package-utils<1,>=0.6.7
Requires-Dist: powercli<1,>=0.3.2
Requires-Dist: superpathlib<3,>=2.0.9
Provides-Extra: dev
Requires-Dist: package-dev-tools<1,>=0.5.11; extra == "dev"
Requires-Dist: package-dev-utils<1,>=0.1.6; extra == "dev"
Requires-Dist: numpy<3,>=1.26.0; extra == "dev"
Requires-Dist: torch<3,>=1.26.0; extra == "dev"

# Cache
[![PyPI version](https://badge.fury.io/py/persistent-function-cache.svg)](https://badge.fury.io/py/persistent-function-cache)
![PyPI downloads](https://img.shields.io/pypi/dm/persistent-function-cache)
![Python version](https://img.shields.io/badge/python-3.10--3.12-brightgreen)
![Operating system](https://img.shields.io/badge/os-linux%20%7c%20macOS%20%7c%20windows-brightgreen)
![Coverage](https://img.shields.io/badge/coverage-100%25-brightgreen)

## Usage
Use

```shell
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
```shell
pip install persistent-function-cache
```
