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.11, 3.12, 3.13, and PyPy 3.10.

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.29.1.tar.gz (20.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mezmorize-0.29.1-py2.py3-none-any.whl (16.7 kB view details)

Uploaded Python 2Python 3

File details

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

File metadata

  • Download URL: mezmorize-0.29.1.tar.gz
  • Upload date:
  • Size: 20.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.12.1.2 readme-renderer/44.0 requests/2.32.5 requests-toolbelt/1.0.0 urllib3/2.5.0 tqdm/4.67.1 importlib-metadata/8.7.0 keyring/25.6.0 rfc3986/2.0.0 colorama/0.4.6 CPython/3.12.10

File hashes

Hashes for mezmorize-0.29.1.tar.gz
Algorithm Hash digest
SHA256 5e4d023374bd1af20ada3e33f6a0e9c2bf6f075506d9e24becf339ae7e4de706
MD5 b0eb620e2f754ec8ec90806445b04651
BLAKE2b-256 b11fbd78c2eecbf16037ff7d3f21260764bf86082c1d7e239e18b15f23dd4f59

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mezmorize-0.29.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 16.7 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.12.1.2 readme-renderer/44.0 requests/2.32.5 requests-toolbelt/1.0.0 urllib3/2.5.0 tqdm/4.67.1 importlib-metadata/8.7.0 keyring/25.6.0 rfc3986/2.0.0 colorama/0.4.6 CPython/3.12.10

File hashes

Hashes for mezmorize-0.29.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 41b22ddb78eb05de3165f6534d77f007544fab27204f4171a0dc2453dfd20952
MD5 328f0745b2c9c73fd0f5b91fe6c2fb03
BLAKE2b-256 b06a9f24533966425846b1e62d1b736121060e3056bdcc333c3dbc9d380fc76f

See more details on using hashes here.

Supported by

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