Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/willcrichton/pickle-cache

Small utility for easily and efficiently saving/loading Python values to disk.
https://github.com/willcrichton/pickle-cache

Last synced: 23 days ago
JSON representation

Small utility for easily and efficiently saving/loading Python values to disk.

Awesome Lists containing this project

README

        

# pickle-cache

Small utility for easily and efficiently saving/loading Python values to disk.

## Installation

```
pip install pickle-cache
```

## Usage

```python
from pickle_cache import PickleCache

pc = PickleCache()

pc.set('foo', 'bar')
assert(pc.get('foo') == 'bar')

class Test:
def __init__(self, x):
self._x = x

def make_test():
return Test(1)

assert(pc.get('test', make_test)._x == 1) # compute if not exists
assert(pc.get('test', make_test)._x == 1) # cache if exists
```