Skip to main content

Cache Alchemy

https://img.shields.io/pypi/v/cache-alchemy.svg CI Test Status Documentation Status https://img.shields.io/pypi/pyversions/cache-alchemy.svg https://codecov.io/gh/GuangTianLi/cache-alchemy/branch/master/graph/badge.svg https://img.shields.io/badge/code%20style-black-000000.svg

The Python Cache Toolkit.

Installation

$ pipenv install cache-alchemy
✨🍰✨

Only Python 3.6+ is supported.

Example

import dataclasses

from redis import Redis

from cache_alchemy import memory_cache, json_cache, pickle_cache
from cache_alchemy.config import DefaultConfig

config = DefaultConfig()
config.cache_redis_client = Redis.from_url(config.CACHE_ALCHEMY_REDIS_URL)


@dataclasses.dataclass
class User:
    name: str


@pickle_cache()
def get(name: str) -> User:
    return User(name=name)


@memory_cache()
def add(i: complex, j: complex) -> complex:
    return i + j


@json_cache()
def add(i: int, j: int) -> int:
    return i + j

Features

  • Distributed cache

  • Cache clear and partial clear with specific function parameter

  • Cache clear cascade by dependency

  • Cache Json Serializable function return value with json_cache

  • Cache Python Object function return value with pickle_cache

  • Cache any function return value with memory_cache

  • LRU Dict support

TODO

History

0.4.* (2020)

  • Refactory redis cache to json cache

  • Support pickle Cache

  • Add backend class in function hash

  • Add cache key prefix to avoid key conflict

0.2.* (2019)

  • Support Partially Clear Cache with Arguments

  • Support Flush Backend Cache

  • Cache Redis Client Must Decode Responses

0.1.* (2019)

  • Support Method and Property Cache

  • Support cache as a decorator with no arguments.

  • Init Project.

Metadata

Release files for cache-alchemy 0.4.5

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

Source distribution (sdist)

Source distribution for cache-alchemy 0.4.5
File Size Uploaded
cache-alchemy-0.4.5.tar.gz 22.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cache-alchemy 0.4.5
File Interpreter ABI Platform
cache_alchemy-0.4.5-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 35.8 kB

Release files / cache-alchemy-0.4.5.tar.gz

Download URL cache-alchemy-0.4.5.tar.gz
Size 22.3 kB
Tags Source
SHA-256 checksum
How to use checksums
06d6768992b72b6572dc73678ae12c6b8cd9edde0299ec616822f0ac85562b99
BLAKE2b-256 checksum
How to use checksums
d74fd1478019b4541772aa8520d84dc74053e61ca1c78ade17e8bf4fe4f14557
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.9.6

Release files / cache_alchemy-0.4.5-py2.py3-none-any.whl

Download URL cache_alchemy-0.4.5-py2.py3-none-any.whl
Size 13.5 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
3622059e922ee1abe9e97218a0fa433be8c3ffe0daa518bb5f2c246d672ec6d5
BLAKE2b-256 checksum
How to use checksums
a059d757a3edb10f8f3ad6ff4bd9caf795ede951275223512c4efe8271c507d5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.9.6

Release history Release notifications | RSS feed

This release

0.4.5 This release

2 release files

0.4.4

2 release files

0.4.3

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

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