Skip to main content

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

Metadata

Release files for kioku 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for kioku 0.1.0
File Size Uploaded
kioku-0.1.0.tar.gz 4.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for kioku 0.1.0
File Interpreter ABI Platform
kioku-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 7.3 kB

Release files / kioku-0.1.0.tar.gz

Download URL kioku-0.1.0.tar.gz
Size 4.0 kB
Tags Source
SHA-256 checksum
How to use checksums
a0bc99ba6a3f55bddb4ff32cc2c81b1651105d3c2d6844d84e99c93147799fe3
BLAKE2b-256 checksum
How to use checksums
2461e1aca1cbdc3bb680701c217175e246b8966a7fd1bbbc6bfee340d3ca8fda
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.13 CPython/3.8.10 Linux/5.13.0-1015-gcp

Release files / kioku-0.1.0-py3-none-any.whl

Download URL kioku-0.1.0-py3-none-any.whl
Size 3.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ce1fd124118af6cad27fcd1fff25c50b965bf6227dda7e6ebf6a0e8af8eb09e9
BLAKE2b-256 checksum
How to use checksums
a51ac2474df00888ffca136921bb2f55c9149ef114325f832915619b9b6c8ec9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.13 CPython/3.8.10 Linux/5.13.0-1015-gcp

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page