Skip to main content

pydis

PyPI-version Python-version

English | 简体中文

Based on python's dict bottom layer, it implements management similar to redis interface

If you want to manage memory like redis, but don't want to introduce as many services as redis, you can use pydis, Of course, pydis is completely implemented based on python's dict, and only has the basic functions of redis. Please evaluate this carefully before using it.

install

pip install pydictdis

Usage

config

from pydis import Pydis

manager = Pydis()

manager.set_config("default_timeout", 50) # set default timeout is 50 seconds

simple usage

from pydis import Pydis

manager = Pydis()

manager.set("key1", "value1")
manager.get("key1")  # value1

manager.delete("key1")
manager.get("key1")  # None

ttl usage

from pydis import Pydis


manager = Pydis()
manager.set("key2", "value2", timeout=10)
print(manager.ttl("key2"))
# wait 10 seconds
manager.get("key2") # return None, because key2 already expired

incr and decr usage

from pydis import Pydis


manager = Pydis()

manager.set("key3", 0)
manager.incr("key3")
manager.incr("key3")
manager.incr("key3")
print(manager.get("key3"))  # 3

manager.decr("key3")
print(manager.get("key3"))  # 2

keys usage

from pydis import Pydis


manager = Pydis()

manager.set("key1", "value1")
print(list(manager.keys()))  # ["key1"]

set_nx

from pydis import Pydis


manager = Pydis()

manager.set_nx('key1', 'value')
manager.set_nx('key1', 'value1')
manager.get('key1')  # value

clean

from pydis import Pydis


manager = Pydis()

manager.set('key', 'value')
manager.set('key1', 'value1', timeout=1)
# after one seconds
manager.clean() # only have key in pydis, key1 already deleted

force_clean

from pydis import Pydis


manager = Pydis()
manager.set('key', 'value')
manager.set('key1', 'value1', timeout=1)
manager.force_clean()  # will delete all key

Metadata

Release files for pydictdis 0.1.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pydictdis 0.1.5
File Size Uploaded Provenance Actions
pydictdis-0.1.5.tar.gz 9.0 kB Without provenance Details for pydictdis-0.1.5.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pydictdis 0.1.5
File Interpreter ABI Platform Actions
pydictdis-0.1.5-py3-none-any.whl Python 3 none any Details for pydictdis-0.1.5-py3-none-any.whl

Total release size: 19.4 kB

Release files / pydictdis-0.1.5.tar.gz

Download URL pydictdis-0.1.5.tar.gz
Size 9.0 kB
Tags Source
SHA-256 checksum
How to use checksums
f13a67e1ab9a984569478e5e4c5150b2153faa50ecfec7791a35d0736b6f2930
BLAKE2b-256 checksum
How to use checksums
939512336edfe363bfde4e86170da2650f035680098653287f4c4927d2cacbac
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.4

Release files / pydictdis-0.1.5-py3-none-any.whl

Download URL pydictdis-0.1.5-py3-none-any.whl
Size 10.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c9416724523881c4ac881ca0a91e38187db2d2d001234097874a213fb8be2ce1
BLAKE2b-256 checksum
How to use checksums
7b37e9f5f8d2c9209d0339a8058df18e89b7e43b6648031fdf987c70d607b96f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.4

Security for pydictdis 0.1.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page