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.31.0.tar.gz (20.6 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.31.0-py2.py3-none-any.whl (16.7 kB view details)

Uploaded Python 2Python 3

File details

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

File metadata

  • Download URL: mezmorize-0.31.0.tar.gz
  • Upload date:
  • Size: 20.6 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.31.0.tar.gz
Algorithm Hash digest
SHA256 2d5e1f1526e0f4c3caf874060825f03cc1e46b970461bf3fc7f56b7b664e743c
MD5 ca35440b9df69f7bf71f76181b617255
BLAKE2b-256 48b872483838b426ab7deede3e2487674965a5561dc1c72c090914d56a330154

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mezmorize-0.31.0-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.31.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 80ef9d0c8aa2fd9405c4b3bffd246e735dce0a2aec8a629a8ea826d5821f71c6
MD5 74fa9da6dcdb795b796c869cc8bb3967
BLAKE2b-256 ae8cede1eb9e2c2b975bc92544e752ae9b1e699fe64b4a91bb7560f40c0c7389

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