Skip to content

psjay/PyLocache

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PyLocache

image

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)

About

Python Local Cache

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages