Pure typed Python Key Value Database/Cache with abstract storage, plugins and asynchronous support
Project description
zcache is pure typed Python implementation of key value Cache/Database with abstract storage and plugins.
Installation
pip install zcache
example
basic example:
from zcache import Cache
import time
c = Cache(path="/tmp/tes1.cache")
print("set foo=bar: ", c.set("foo", "bar"))
print("c size:", c.size())
print("c has foo: ", c.has("foo"))
print("c get foo: ", c.get("foo"))
print("c delete foo: ", c.delete("foo"))
print("c has foo: ", c.has("foo"))
print("c has spam:", c.has("spam"))
print("c set spam=eggs, ttl=3: ", c.set("spam", "eggs", ttl=3)) # cache with ttl
print("c has spam:", c.has("spam"))
print("sleep 3")
time.sleep(3)
print("c has spam:", c.has("spam"))
print("c size:", c.size())
example with limited stack:
from zcache import Cache
d = Cache(path="/tmp/test2.cache", limit=2)
d.reset() # reset cache stack to 0
print(d.set("one", 1)) # True
print(d.set("two", 2)) # True
print(d.set("three", 3)) # False out of stack limit
d.delete("one") # delete one item from stack
print(d.set("three", 3)) # True
Version Limited
version ^2.0.2 is limited without Asynchronous and no need any dependency.
License
MIT
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file zcache-2.0.4.tar.gz.
File metadata
- Download URL: zcache-2.0.4.tar.gz
- Upload date:
- Size: 19.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.10.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
121634e4eb67132caaf132be7024b8836713318583e07612e37b1050677d4f42
|
|
| MD5 |
0d1cd041e3d223ae9562df1db9c3deec
|
|
| BLAKE2b-256 |
038e5467e7cc60b5855cbafbb772064855627630c9204813d322d69ac04c8f88
|
File details
Details for the file zcache-2.0.4-py3-none-any.whl.
File metadata
- Download URL: zcache-2.0.4-py3-none-any.whl
- Upload date:
- Size: 18.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.10.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
61f8daf3ba3d817f776bf5717f429631f26159f17e804cad6f8a8df589f1c678
|
|
| MD5 |
d5bc92b9a0c617c069aed9ff89b0520d
|
|
| BLAKE2b-256 |
942e5d85596e29a6f4a3616061c9e2427f5a9f16e518946238f8c80ec33f4f63
|