Skip to main content

Pure typed Python Key Value Database/Cache with abstract storage, plugins and asynchronous support

Project description

status workflow test status workflow build

Downloads Downloads Downloads

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


Download files

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

Source Distribution

zcache-2.0.2.tar.gz (19.5 kB view details)

Uploaded Source

Built Distribution

zcache-2.0.2-py3-none-any.whl (18.3 kB view details)

Uploaded Python 3

File details

Details for the file zcache-2.0.2.tar.gz.

File metadata

  • Download URL: zcache-2.0.2.tar.gz
  • Upload date:
  • Size: 19.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.15

File hashes

Hashes for zcache-2.0.2.tar.gz
Algorithm Hash digest
SHA256 0f57e882ab247f93555e50574ddd9177580b86ed18125b20182f085e9de982c6
MD5 580c391b9639125480dc23ae048cddfe
BLAKE2b-256 ebdd5009cec8676a89e36539985cd93ed2c458a1230e019747d53a4175ef18dd

See more details on using hashes here.

File details

Details for the file zcache-2.0.2-py3-none-any.whl.

File metadata

  • Download URL: zcache-2.0.2-py3-none-any.whl
  • Upload date:
  • Size: 18.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.15

File hashes

Hashes for zcache-2.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 2121e9a197720e5262d978c19351e1a56089aa4567f7a1e2c4609f7a27004414
MD5 2f4c98c8ec36e9d2aa4d0937dc681aba
BLAKE2b-256 1a1da82f64d3eac4f4a6206fffdc05025fe5c58d1449f3ce0f6ca7ca6288bd85

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page