Adds function memoization support
Project description
mezmorize
A python function memoization library heavily inspired by Flask-Cache.
This is a fork of the Flask-Cache extension.
Setup
mezmorize is available on PyPI and can be installed with:
pip install mezmorize
Usage
from random import randrange
from mezmorize import Cache
cache = Cache(CACHE_TYPE='simple')
@cache.memoize(60)
def add(a, b):
return a + b + randrange(0, 1000)
# Initial
add(2, 5)
# Memoized
add(2, 5)
add(2, 5)
# Delete cache
cache.delete_memoized(add)
# Initial
add(2, 5)
For more configuration options, check out the the examples or Flask-Caching documentation.
Compatibility with Flask-Cache and Flask-Caching
There are no known incompatibilities or breaking changes between either the latest Flask-Cache v0.13 or Flask-Caching v1.8.0 and the current version of mezmorize.
Python versions
Starting with version 0.26.0, mezmorize dropped Python 2 support. The library is tested against Python 3.6, 3.7, 3.8, and PyPy 3.6.
Environment Variables
- CACHE_DIR: the directory your cache will be stored in. The default is the
cache
dir in the current folder.
Links
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
Built Distribution
File details
Details for the file mezmorize-0.28.1.tar.gz
.
File metadata
- Download URL: mezmorize-0.28.1.tar.gz
- Upload date:
- Size: 25.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b53ea3f315cf5f938337cc8bb68410dc40260922dadfc7129861223928952bef |
|
MD5 | b50f29b38c71a384b6ae05ff598e88d5 |
|
BLAKE2b-256 | 908a8eb0c2d1c1d56d6d6af6206a6f807244c204efbb67d352d823eaec60a5b5 |
File details
Details for the file mezmorize-0.28.1-py2.py3-none-any.whl
.
File metadata
- Download URL: mezmorize-0.28.1-py2.py3-none-any.whl
- Upload date:
- Size: 14.2 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6a6844bfffd871f89954e7178d2c3e5d42ad17d809345b5ffe23523e2408bdc3 |
|
MD5 | 2fae75645a05d81bb05ffb628c8b8221 |
|
BLAKE2b-256 | b5d12ac3debe6464aad99d6ef25a936abdd4dde9439cb28a32bcdcd718dd3e6a |