a performant python cacheing library
Project description
cacheing - Pure Python Cacheing Library
Motivation
The initial motivation behind this package was twofold: fix the long insertion/eviction times in cachetools.LFUCache
and provide an alternative to the cachetools.TTLCache
offering variable per-key TTL's.
Installation
pip install -U cacheing
And then in your python interpreter:
import cacheing
Updating
Usage
>>> from cacheing import LFUCache
>>> cache = LFUCache(capacity=2)
>>> cache[1] = 2
>>> cache[2] = 3
>>> cache[3] = 4
>>> cache
LFUCache{2: 3, 3: 4}
Benchmark
cacheing has an included benchmarking library found in ./benchmark
.
$ python3 ./benchmark.py --help
usage: benchmark [-h] [--cache [CACHE [CACHE ...]]] [--method [{get,set,delete} [{get,set,delete} ...]]]
arguments:
-h, --help show this help message and exit
--cache [CACHE [CACHE ...]], -c [CACHE [CACHE ...]]
cache(s) to benchmark. example: cacheing.LRUCache.
--method [{get,set,delete} [{get,set,delete} ...]], -m [{get,set,delete} [{get,set,delete} ...]]
method(s) to benchmark.
Run the Benchmarks:
$ cd benchmark
$ python3 ./benchmark.py --cache cachetools.LRUCache cacheing.LRUCache --method set get delete
Performance
All benchmark times were measured using the provided benchmark
library. See the
benchmark section for details. The default benchmarking configuration executes 100,000 get operations,
20,000 set operations and n = cache_size
delete operations. The median, p90, and p99 times for each
operation, measured in microseconds, or 1e-6
, are displayed in the figures below.
Get (LFU Cache) Delete (LFU Cache)
Set (LFU Cache) Set - Cross Section (LFU Cache)
Set (LRU Cache) Get (LRU Cache)
Delete (LRU Cache)
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
Built Distribution
File details
Details for the file cacheing-0.1.1.tar.gz
.
File metadata
- Download URL: cacheing-0.1.1.tar.gz
- Upload date:
- Size: 11.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.2.2 CPython/3.10.3 Windows/10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | eb83d67c5d7af5364f1a338da2c5cf26b4623c5f5670bd2a61ee93123d1b00c2 |
|
MD5 | 499c44486586d59a6de9461f87212839 |
|
BLAKE2b-256 | 1e5a3dcf8f1a3b6fcbdebcb3f3b94082973ec0384d40bfcd3d59dcec17991dca |
File details
Details for the file cacheing-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: cacheing-0.1.1-py3-none-any.whl
- Upload date:
- Size: 10.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.2.2 CPython/3.10.3 Windows/10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3719f9d5c2a846ed2839d65a76c4bd5bd4c440fa37d92af998545a7fa571ee3f |
|
MD5 | 7b9b9a7ea030defc34090abc931681bb |
|
BLAKE2b-256 | d2c8c8d8668700b51dd99dfda012f3ba0fd013ff685f8a6665ecff3b61f12fe1 |