dtpyredis


Namedtpyredis JSON
Version 0.1.5 PyPI version JSON
download
home_pageNone
SummaryA light python package for redis management.
upload_time2025-02-07 13:17:31
maintainerNone
docs_urlNone
authorReza Shirazi
requires_python<4.0,>=3.11
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Redis Client Wrapper

This repository provides a Redis client wrapper for both synchronous and asynchronous interactions with Redis. It allows for easy configuration and connection management using a `RedisConfig` class.

## Features
- Support for both synchronous (`redis.Redis`) and asynchronous (`redis.asyncio.Redis`) clients.
- Configurable Redis connection settings.
- Secure connection handling with optional SSL (`rediss://` support).
- Context managers for clean resource management.

## Installation

```bash
pip install dtpyredis
```

## Usage

### Configuration
You can configure Redis settings using `RedisConfig`:

```python
from dtpyredis.config import RedisConfig
from dtpyredis.connection import RedisInstance

config = (
    RedisConfig()
    .set_redis_host("localhost")
    .set_redis_port(6379)
    .set_redis_db(0)
    .set_redis_password("your_password")
)
```

### Creating a Redis Client

#### Synchronous Client

```python
redis_instance = RedisInstance(config)

with redis_instance.get_redis() as client:
    client.set("foo", "bar")
    value = client.get("foo")
    print(value)  # Output: b'bar'
```

#### Asynchronous Client

```python
import asyncio

async def async_example():
    async with redis_instance.get_async_redis() as async_client:
        await async_client.set("foo", "bar")
        value = await async_client.get("foo")
        print(value)  # Output: b'bar'

asyncio.run(async_example())
```


            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "dtpyredis",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.11",
    "maintainer_email": null,
    "keywords": null,
    "author": "Reza Shirazi",
    "author_email": "reza@datgate.com",
    "download_url": "https://files.pythonhosted.org/packages/17/17/dd560c3c073a4731580fafe44b3096ab483b352b00c2f696c1cb6597249b/dtpyredis-0.1.5.tar.gz",
    "platform": null,
    "description": "# Redis Client Wrapper\n\nThis repository provides a Redis client wrapper for both synchronous and asynchronous interactions with Redis. It allows for easy configuration and connection management using a `RedisConfig` class.\n\n## Features\n- Support for both synchronous (`redis.Redis`) and asynchronous (`redis.asyncio.Redis`) clients.\n- Configurable Redis connection settings.\n- Secure connection handling with optional SSL (`rediss://` support).\n- Context managers for clean resource management.\n\n## Installation\n\n```bash\npip install dtpyredis\n```\n\n## Usage\n\n### Configuration\nYou can configure Redis settings using `RedisConfig`:\n\n```python\nfrom dtpyredis.config import RedisConfig\nfrom dtpyredis.connection import RedisInstance\n\nconfig = (\n    RedisConfig()\n    .set_redis_host(\"localhost\")\n    .set_redis_port(6379)\n    .set_redis_db(0)\n    .set_redis_password(\"your_password\")\n)\n```\n\n### Creating a Redis Client\n\n#### Synchronous Client\n\n```python\nredis_instance = RedisInstance(config)\n\nwith redis_instance.get_redis() as client:\n    client.set(\"foo\", \"bar\")\n    value = client.get(\"foo\")\n    print(value)  # Output: b'bar'\n```\n\n#### Asynchronous Client\n\n```python\nimport asyncio\n\nasync def async_example():\n    async with redis_instance.get_async_redis() as async_client:\n        await async_client.set(\"foo\", \"bar\")\n        value = await async_client.get(\"foo\")\n        print(value)  # Output: b'bar'\n\nasyncio.run(async_example())\n```\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A light python package for redis management.",
    "version": "0.1.5",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "4929f5fa0a84be40fe1d962cbf4d0ae2c87dfdef88c02b019dd6bdddeb4c3fea",
                "md5": "2b75c0ccfd3a7db370162038e189834f",
                "sha256": "f5465081a64d6cb7f26ec4467dc5732a1ef277877eef59f919234d45e14400a0"
            },
            "downloads": -1,
            "filename": "dtpyredis-0.1.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "2b75c0ccfd3a7db370162038e189834f",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.11",
            "size": 4689,
            "upload_time": "2025-02-07T13:17:29",
            "upload_time_iso_8601": "2025-02-07T13:17:29.991783Z",
            "url": "https://files.pythonhosted.org/packages/49/29/f5fa0a84be40fe1d962cbf4d0ae2c87dfdef88c02b019dd6bdddeb4c3fea/dtpyredis-0.1.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "1717dd560c3c073a4731580fafe44b3096ab483b352b00c2f696c1cb6597249b",
                "md5": "55980286711c43375aef295d65df13c5",
                "sha256": "047224d31c151ec542536a8cbd4073142fdf2f78806c5bf1a1341f091b03507c"
            },
            "downloads": -1,
            "filename": "dtpyredis-0.1.5.tar.gz",
            "has_sig": false,
            "md5_digest": "55980286711c43375aef295d65df13c5",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.11",
            "size": 3375,
            "upload_time": "2025-02-07T13:17:31",
            "upload_time_iso_8601": "2025-02-07T13:17:31.663685Z",
            "url": "https://files.pythonhosted.org/packages/17/17/dd560c3c073a4731580fafe44b3096ab483b352b00c2f696c1cb6597249b/dtpyredis-0.1.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-02-07 13:17:31",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "dtpyredis"
}
        
Elapsed time: 0.41800s