Skip to main content

The Python Cache Toolkit.

Project description

Cache Alchemy

https://img.shields.io/pypi/v/cache-alchemy.svg https://img.shields.io/travis/GuangTianLi/cache-alchemy.svg 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

from cache_alchemy import memory_cache, redis_cache
from cache_alchemy.config import DefaultConfig
from redis import StrictRedis

config = DefaultConfig()
config.client = StrictRedis.from_url(config.CACHE_ALCHEMY_REDIS_URL)

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

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

Features

  • Cache Json Serializable function return value with Distributed Redis Cache

  • Cache any function return value with Distributed Memory Cache

  • LRU Dict support - behave like normal dict

TODO

History

0.1.* (2019)

  • Support Method and Property Cache

  • Support cache as a decorator with no arguments.

  • Init Project.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cache-alchemy-0.1.3.tar.gz (15.6 kB view hashes)

Uploaded Source

Built Distribution

cache_alchemy-0.1.3-py2.py3-none-any.whl (10.2 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page