high performance in-memory cache
Project description
theine
High performance in-memory cache inspired by Caffeine.
- High performance Rust core
- High hit ratio with W-TinyLFU evication policy
- Expired data are removed automatically using hierarchical timer wheel
- Simple API
- Django cache backend
Benchmarks
https://github.com/Yiling-J/cacheme-benchmark
Requirements
Python 3.7+
Installation
pip install theine
API
from theine import Cache
from datetime import timedelta
cache = Cache("tlfu", 10000)
# without default, return None on miss
v = cache.get("key")
# with default, return default on miss
sentinel = object()
v = cache.get(key, sentinel)
# set with ttl
cache.set("key", {"foo": "bar"}, timedelta(seconds=100))
# delete from cache
cache.delete("key")
Django Cache Backend
CACHES = {
"default": {
"BACKEND": "theine.adapters.django.Cache",
"TIMEOUT": 300,
"OPTIONS": {"MAX_ENTRIES": 10000},
},
}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
theine-0.1.2.tar.gz
(3.2 kB
view hashes)
Built Distribution
theine-0.1.2-py3-none-any.whl
(3.9 kB
view hashes)