Skip to main content

PyMemo: simple Python memoization library

Project description

PyMemo

Simple Python memoization library.

Installation

pip install pymemo-cache

Simple Usage

from pymemo import PyMemo


memo = PyMemo()

# Creates collections with optional expiration interval
articles_cache = memo.create_collection('articles', expiration_interval=15)
comments_cache = memo.create_collection('comments', expiration_interval=60)

articles_cache.set_item('article-1', {'id': 1, 'title': 'Article Example'}) # Any data type
articles_cache.get_item('article-1') # -> {'id': 1, 'title': 'Article Example'}

# After 15 seconds
articles_cache.get_item('article-1') # -> None

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

pymemo-cache-1.0.0.2.tar.gz (3.0 kB view hashes)

Uploaded Source

Built Distribution

pymemo_cache-1.0.0.2-py3-none-any.whl (4.1 kB view hashes)

Uploaded Python 3

Supported by

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