Skip to main content

🎲 DiceDB Python Client

Welcome to the DiceDB Python Client! This project provides an efficient way to interact with DiceDB using Python, managing connection pools and executing commands with ease.

How to Install

pip install dicedb-py

OR

poetry add dicedb-py

📝 Usage

import asyncio

from dicedb_py import Dice


async def main():
    dice = Dice(host="localhost", port=7379)
    print(await dice.set("foo", "bar"))
    val = await dice.get("foo")
    print(val)


if __name__ == "__main__":
    asyncio.run(main())

🛠️ Commands

  • SET: set key-value
    Ex: await dice.set("key", "val)

  • GET: get value from key
    Ex: await dice.get("key")

  • DEL: delete key
    Ex: await dice.delete("key")

  • EXISTS: check if a key exists & returns bool
    Ex: await dice.exists("key")

  • EXPIRE: sets ttl in seconds for a key
    Ex: await dice.expire("key", 10)

  • KEYS: get all keys in a list according to the pattern give. Use "_" for all keys.
    Ex: await dice.keys("_")

  • FLUSH: clear all keys
    Ex: await dice.flush()

  • INCR: incr key by 1. Default value to start is 0 if key is not already set.
    Ex: await dice.incr("key")

  • INCRBY: incr key by amount (int)
    Ex: await dice.incrby("key", 2)

  • DECR: decr key by 1.
    Ex: await dice.decr("key")

  • DECRBY: decr key by amount (int)
    Ex: await dice.decrby("key", 2)

  • TTL: get TTL (time to live) of the key in seconds
    Ex: await dice.ttl("key")

Metadata

Release files for dicedb-py 0.0.2

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

Source distribution (sdist)

Source distribution for dicedb-py 0.0.2
File Size Uploaded
dicedb_py-0.0.2.tar.gz 4.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for dicedb-py 0.0.2
File Interpreter ABI Platform
dicedb_py-0.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 11.0 kB

Release files / dicedb_py-0.0.2.tar.gz

Download URL dicedb_py-0.0.2.tar.gz
Size 4.5 kB
Tags Source
SHA-256 checksum
How to use checksums
a3e06f3fc704418f726915102768228e8c7f198781480e21e5c8f94def29c896
BLAKE2b-256 checksum
How to use checksums
fe9c77ea457b836f405efbe4510e86fe6e041e3d0bad2d565f52fe47a050f125
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.4 CPython/3.10.15 Linux/6.5.0-1025-azure

Release files / dicedb_py-0.0.2-py3-none-any.whl

Download URL dicedb_py-0.0.2-py3-none-any.whl
Size 6.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b583f8780926a2159d953ee0066ef3f6372ddfa9fe82d3bac0c718a9c2041056
BLAKE2b-256 checksum
How to use checksums
e83db1d6bb6bd3d39d56ed7b23332a8c358ba654cb0b39e967b0012bcce8c411
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.4 CPython/3.10.15 Linux/6.5.0-1025-azure

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files

0.0.1

2 release files

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