dicedb-py


Namedicedb-py JSON
Version 0.0.2 PyPI version JSON
download
home_pagehttps://priyanshu-panwar.github.io/dice-py
SummaryPython Client for DiceDB
upload_time2024-11-09 12:17:55
maintainerNone
docs_urlNone
authorPriyanshu Panwar
requires_python<4.0,>=3.9
licenseMIT
keywords dice dice-py dice-db dicedb python client
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 🎲 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

```bash
pip install dicedb-py
```

OR

```bash
poetry add dicedb-py
```

## 📝 Usage

```bash
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")`

            

Raw data

            {
    "_id": null,
    "home_page": "https://priyanshu-panwar.github.io/dice-py",
    "name": "dicedb-py",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.9",
    "maintainer_email": null,
    "keywords": "dice, dice-py, dice-db, dicedb, python, client",
    "author": "Priyanshu Panwar",
    "author_email": "priyanshu009ch@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/fe/9c/77ea457b836f405efbe4510e86fe6e041e3d0bad2d565f52fe47a050f125/dicedb_py-0.0.2.tar.gz",
    "platform": null,
    "description": "# \ud83c\udfb2 DiceDB Python Client\n\nWelcome 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.\n\n## How to Install\n\n```bash\npip install dicedb-py\n```\n\nOR\n\n```bash\npoetry add dicedb-py\n```\n\n## \ud83d\udcdd Usage\n\n```bash\nimport asyncio\n\nfrom dicedb_py import Dice\n\n\nasync def main():\n    dice = Dice(host=\"localhost\", port=7379)\n    print(await dice.set(\"foo\", \"bar\"))\n    val = await dice.get(\"foo\")\n    print(val)\n\n\nif __name__ == \"__main__\":\n    asyncio.run(main())\n```\n\n## \ud83d\udee0\ufe0f Commands\n\n- `SET`: set key-value  \n  Ex: `await dice.set(\"key\", \"val)`\n\n- `GET`: get value from key  \n  Ex: `await dice.get(\"key\")`\n\n- `DEL`: delete key  \n  Ex: `await dice.delete(\"key\")`\n\n- `EXISTS`: check if a key exists & returns bool  \n  Ex: `await dice.exists(\"key\")`\n\n- `EXPIRE`: sets ttl in seconds for a key  \n  Ex: `await dice.expire(\"key\", 10)`\n\n- `KEYS`: get all keys in a list according to the pattern give. Use \"_\" for all keys.  \n  Ex: `await dice.keys(\"_\")`\n\n- `FLUSH`: clear all keys  \n  Ex: `await dice.flush()`\n\n- `INCR`: incr key by 1. Default value to start is 0 if key is not already set.  \n  Ex: `await dice.incr(\"key\")`\n\n- `INCRBY`: incr key by amount (int)  \n  Ex: `await dice.incrby(\"key\", 2)`\n\n- `DECR`: decr key by 1.  \n  Ex: `await dice.decr(\"key\")`\n\n- `DECRBY`: decr key by amount (int)  \n  Ex: `await dice.decrby(\"key\", 2)`\n\n- `TTL`: get TTL (time to live) of the key in seconds  \n  Ex: `await dice.ttl(\"key\")`\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Python Client for DiceDB",
    "version": "0.0.2",
    "project_urls": {
        "Homepage": "https://priyanshu-panwar.github.io/dice-py",
        "Repository": "https://github.com/priyanshu-panwar/dice-py"
    },
    "split_keywords": [
        "dice",
        " dice-py",
        " dice-db",
        " dicedb",
        " python",
        " client"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e83db1d6bb6bd3d39d56ed7b23332a8c358ba654cb0b39e967b0012bcce8c411",
                "md5": "44ac334655feda86a16ff8b54997fde3",
                "sha256": "b583f8780926a2159d953ee0066ef3f6372ddfa9fe82d3bac0c718a9c2041056"
            },
            "downloads": -1,
            "filename": "dicedb_py-0.0.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "44ac334655feda86a16ff8b54997fde3",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.9",
            "size": 6468,
            "upload_time": "2024-11-09T12:17:53",
            "upload_time_iso_8601": "2024-11-09T12:17:53.653094Z",
            "url": "https://files.pythonhosted.org/packages/e8/3d/b1d6bb6bd3d39d56ed7b23332a8c358ba654cb0b39e967b0012bcce8c411/dicedb_py-0.0.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "fe9c77ea457b836f405efbe4510e86fe6e041e3d0bad2d565f52fe47a050f125",
                "md5": "4540771aebe34d23b28e018d17d60933",
                "sha256": "a3e06f3fc704418f726915102768228e8c7f198781480e21e5c8f94def29c896"
            },
            "downloads": -1,
            "filename": "dicedb_py-0.0.2.tar.gz",
            "has_sig": false,
            "md5_digest": "4540771aebe34d23b28e018d17d60933",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.9",
            "size": 4490,
            "upload_time": "2024-11-09T12:17:55",
            "upload_time_iso_8601": "2024-11-09T12:17:55.214937Z",
            "url": "https://files.pythonhosted.org/packages/fe/9c/77ea457b836f405efbe4510e86fe6e041e3d0bad2d565f52fe47a050f125/dicedb_py-0.0.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-09 12:17:55",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "priyanshu-panwar",
    "github_project": "dice-py",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "dicedb-py"
}
        
Elapsed time: 0.57307s