Metadata-Version: 2.1
Name: kioku
Version: 0.1.0
Summary: Python package project template.
Home-page: https://github.com/takelushi/kioku
License: MIT
Author: Takeru Saito
Author-email: takelushi@gmail.com
Requires-Python: >=3.7,<4.0
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Project-URL: Repository, https://github.com/takelushi/kioku
Project-URL: issues, https://github.com/takelushi/kioku/issues
Description-Content-Type: text/markdown

# kioku

Simple Cache Library for Python.

## Usage

### Quick Start

```python
import time

from kioku import Cache

cache = Cache('./cache.pkl')

@cache.use()
def calc():
   time.sleep(3)
   return 42

# It takes 3 sec...
print(calc())
# => 42

# Without to run calc() by using cache.
print(calc())
# => 42

# Cache is saved as dict.
# And key is function name.
print(cache.get('calc'))
# => 42
```

### Basic

```py
# Set manually
cache.set('key', 123)
print(cache.get('key'))
# => 123

# Clear
cache.clear('key')
print(cache.get('key'))
# => None
```

### Auto Reloading Cache File

```py
cache = Cache('cache.pkl', auto_reload=True)
```


## Development

* Requirements: poetry, pyenv

```sh
# Setup
poetry install

# Lint & Test
mkdir -p report
poetry run flake8 --format=html --htmldir=report/flake-report .
mypy src/ tests/ --html-report report/mypy
poetry run pytest \
   --html=report/pytest/index.html\
   --cov-report html:report/coverage

# Build and publish
poetry build
poetry publish
```

