Skip to main content

PyMemo: simple Python memoization library

Project description

PyMemo

Simple Python memoization library. Decrease your app's response time!

Installation

pip install pymemo-cache

Usage

from pymemo import PyMemo


memo = PyMemo()

# Creates collections with optional expiration interval
articles_cache = memo.create_collection('articles', expiration_interval=15) # Expires after 15 seconds
comments_cache = memo.create_collection('comments', expiration_interval=60) # Expires after 60 seconds
country_list_cache = memo.create_collection('countries') # Never expires

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

# Set customized expiration interval for individual items
comments_cache.set_item('comment-1', {'id': 1, 'content': 'Lorem ipsum'}, expiration_interval=120) # Expires after 120 seconds instead of 60 seconds

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.1.0.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

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

pymemo_cache-1.1.0-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

Details for the file pymemo-cache-1.1.0.tar.gz.

File metadata

  • Download URL: pymemo-cache-1.1.0.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.10

File hashes

Hashes for pymemo-cache-1.1.0.tar.gz
Algorithm Hash digest
SHA256 2dd3d53d294ee66a5f75b3679148da76aeebde207a031fae2dbc7def315c3b60
MD5 5a072f514a7b2937543937eab8f9a494
BLAKE2b-256 33fa73686cbd7d46aaf2a0f0c854d9d27828fdc0bdd2aedaaf53f59ab66f9b6b

See more details on using hashes here.

File details

Details for the file pymemo_cache-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: pymemo_cache-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.10

File hashes

Hashes for pymemo_cache-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 39ace14e044c585e6981330e6eb6a2449241dfac06784c132c71b4c121d4cf5e
MD5 9243e20b7ec3cbdbc6782c5e5d27311c
BLAKE2b-256 ec521f1a75540bf8cab999bfc47907a961921adec944748ab8dee4a2147f9304

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