Skip to main content

Adds function memoization support

Project description

mezmorize

travis

versions pypi

license

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


Download files

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

Source Distribution

mezmorize-0.28.2.tar.gz (25.6 kB view details)

Uploaded Source

Built Distribution

mezmorize-0.28.2-py2.py3-none-any.whl (14.2 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file mezmorize-0.28.2.tar.gz.

File metadata

  • Download URL: mezmorize-0.28.2.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

Hashes for mezmorize-0.28.2.tar.gz
Algorithm Hash digest
SHA256 b661e38aac2e19baef9caeda909813f2fcb94aacaf6fbd851ff2250e2b354fac
MD5 04144a58120fd838d9c9bdbc55ab77ef
BLAKE2b-256 a2b53f643f90854a5471d1023604c6a3875380ce0f590e2d41b01170ed95e49f

See more details on using hashes here.

File details

Details for the file mezmorize-0.28.2-py2.py3-none-any.whl.

File metadata

  • Download URL: mezmorize-0.28.2-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

Hashes for mezmorize-0.28.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 c37a9e916923d04bc07af91ff113bdfc4a03357056a65634a980ffb55a8da305
MD5 ee498ad992b1aab86c0338abf49bbaa9
BLAKE2b-256 f173c3153951bf8956c92e0a481daa804d57f13970457c32a6692ca6723a026f

See more details on using hashes here.

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