Skip to main content

Memory and disk cache for functions

Project description

Not again!

Memoize any function with this lightweight decorator, even across runs. It stores results in memory and disk.

The decorator makes use of the Pickle module to store (and retrieve) function results in a local cache folder.

Memoization is sensible to the function input arguments and source code, if any of these change the function gets executed and its output cached.

Get it

pip install notagain

Use it

from notagain import memoize

@memoize()
def expensive_function(arg, kwarg=None):
  # i.e. some boring query
  return arg

Control it

You can change the pickles path. You can deactivate memory and/or disk cache.

@memoize(cache_dir='tmp', memory_cache=True, disk_cache=True)

If you would like to disable this library info messages.

logging.getLogger('notagain').setLevel('WARNING')

About the name

https://www.youtube.com/watch?v=SOBNO4gl_yM

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

notagain-0.3.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

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

notagain-0.3-py2.py3-none-any.whl (3.3 kB view details)

Uploaded Python 2Python 3

File details

Details for the file notagain-0.3.tar.gz.

File metadata

  • Download URL: notagain-0.3.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.26.0

File hashes

Hashes for notagain-0.3.tar.gz
Algorithm Hash digest
SHA256 0cbd3662bcd3760dee95e1cd5dba311adf24974c17243473c7d3818d7b9a3e32
MD5 8d419314f26e35444d5a9a5a60dcc5b2
BLAKE2b-256 681763832e623e6bc12576a0b67b7842fcd19d5b0abe807d0b97043af72a2820

See more details on using hashes here.

File details

Details for the file notagain-0.3-py2.py3-none-any.whl.

File metadata

  • Download URL: notagain-0.3-py2.py3-none-any.whl
  • Upload date:
  • Size: 3.3 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.26.0

File hashes

Hashes for notagain-0.3-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 3537d33c2260e75fa9014ddf40930ca6c23bace7070ded47786de43503d6c911
MD5 4a17a03a93d6bb16018972a8e690e976
BLAKE2b-256 a6bb467f2834914af555a6f670d4ad6c4b313f73cebcb72dc0575c9602d165a5

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