Skip to main content

PyLocache is a Python implementation of LRU local cache.

Project description

PyLocache

https://travis-ci.org/psjay/PyLocache.svg?branch=master

PyLocache is a Python implementation of LRU local cache.

Features

  • Memcache-like APIs.
  • Thread safe.
  • Expiration support.

Installation

$ pip install pylocache

virtualenv is strongly recommended.

Usage

from pylocache import LocalCache


cache = LocalCache(max_size=5)
cache.set('foo', 1)
cache.set('bar', 2)

cache.get('foo')  # 1

cache.set('hello', 'world', expires=3)  # expires in 3 seconds.

# All items of it will be expired in 2 seconds after being set.
volatile_cache = LocalCache(max_size=5, expires=2)

Change History

0.0.3

  • Fixed installation bug.

0.0.2

  • Added delete method.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
PyLocache-0.0.4.tar.gz (3.4 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page