Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mezmorize

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mezmorize

Adds function memoization support

  • 0.28.2
  • PyPI
  • Socket score

Maintainers
1

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.

Keywords

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc