Python package project template.
Project description
kioku
Simple Cache Library for Python.
Usage
Quick Start
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
# Set manually
cache.set('key', 123)
print(cache.get('key'))
# => 123
# Clear
cache.clear('key')
print(cache.get('key'))
# => None
Auto Reloading Cache File
cache = Cache('cache.pkl', auto_reload=True)
Development
- Requirements: poetry, pyenv
# 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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
kioku-0.1.0.tar.gz
(4.0 kB
view details)
Built Distribution
kioku-0.1.0-py3-none-any.whl
(3.3 kB
view details)
File details
Details for the file kioku-0.1.0.tar.gz
.
File metadata
- Download URL: kioku-0.1.0.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.13 CPython/3.8.10 Linux/5.13.0-1015-gcp
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a0bc99ba6a3f55bddb4ff32cc2c81b1651105d3c2d6844d84e99c93147799fe3 |
|
MD5 | e3301dfbcb9dfae2ee91a7ab00df761d |
|
BLAKE2b-256 | 2461e1aca1cbdc3bb680701c217175e246b8966a7fd1bbbc6bfee340d3ca8fda |
File details
Details for the file kioku-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: kioku-0.1.0-py3-none-any.whl
- Upload date:
- Size: 3.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.13 CPython/3.8.10 Linux/5.13.0-1015-gcp
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ce1fd124118af6cad27fcd1fff25c50b965bf6227dda7e6ebf6a0e8af8eb09e9 |
|
MD5 | 07b472d947d57e00129a5c44c2ca5bc4 |
|
BLAKE2b-256 | a51ac2474df00888ffca136921bb2f55c9149ef114325f832915619b9b6c8ec9 |