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

Uploaded Python 2Python 3

File details

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

File metadata

  • Download URL: mezmorize-0.30.0.tar.gz
  • Upload date:
  • Size: 20.4 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.30.0.tar.gz
Algorithm Hash digest
SHA256 2b4a337a5c4069eae632830933566bd232bf4790b3e3faab06235ecb38fbb8da
MD5 59d50b00cb65d72a10a70d7c9fde1deb
BLAKE2b-256 a65dd97985c02017fa54ee596d518776c9df34771803ceb30b5718a43865ddda

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mezmorize-0.30.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.30.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 719feef716ec9bcdfc7daaf2a3529dc98b81303efa3fbc182a3cb24a6c0b6ccf
MD5 5062e1b30ee341bceadfff07bf7c050d
BLAKE2b-256 eba03f376568dfa4cf7139da7dc631fbebdf2cfd236327164d17cccdaa280f38

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