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.3.tar.gz (19.6 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: zcache-2.0.3.tar.gz
  • Upload date:
  • Size: 19.6 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.3.tar.gz
Algorithm Hash digest
SHA256 a6895bdeeaaaaf54963a5cfcd87ed24a78c3b607388d5259b34c77d4489ac584
MD5 331c26aa6d4e4ce83c722f60de71dff9
BLAKE2b-256 8d65193b0249ad0eb238518971c36daf81b5cad3db3b31714c76922335b3a96e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: zcache-2.0.3-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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 0844d015029bf42e53962cd57297b89c8df132a50bd4c7ec3a58905fe93d31f9
MD5 8a127f8471e2f71711253781ba2e7d97
BLAKE2b-256 6a47edf467b4744331c4e43efa3c1051e9090bfcb8713f2065bafd04fab2b001

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