muffin-redis


Namemuffin-redis JSON
Version 3.9.1 PyPI version JSON
download
home_pagehttps://github.com/klen/muffin-redis
SummaryRedis support for Muffin framework.
upload_time2025-07-18 09:23:20
maintainerNone
docs_urlNone
authorKirill Klenov
requires_python<4.0,>=3.10
licenseMIT
keywords redis muffin asgi asyncio
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Muffin-Redis

**Muffin-Redis** — Redis support for the [Muffin](https://github.com/klen/muffin) framework.

![Tests Status](https://github.com/klen/muffin-redis/workflows/tests/badge.svg)
[![PyPI Version](https://img.shields.io/pypi/v/muffin-redis)](https://pypi.org/project/muffin-redis/)
[![Python Versions](https://img.shields.io/pypi/pyversions/muffin-redis)](https://pypi.org/project/muffin-redis/)

---

## Features

- Built on `redis.asyncio` client.
- Optional support for `redislite` with Unix socket configuration.
- JSON serialization support
- Automatic connection pool management (blocking or non-blocking).
- Simple `get()` / `set()` with optional `jsonify` flag.
- Lifecycle support: `startup` and `shutdown` integrate with Muffin app lifecycle.

## Requirements

- Python >= 3.10

## Installation

Install using pip:

```bash
pip install muffin-redis
```

Optionally with `redislite`:

```bash
pip install muffin-redis[redislite]
```

## Usage

Setup the plugin and connect it into your app:

```python
from muffin import Application
from muffin_redis import Plugin as Redis

app = Application('example')

# Initialize the plugin
redis = Redis(address='redis://localhost')
redis.setup(app)
```

You can now use Redis in your routes:

```python
@app.route('/some_url', methods=['POST'])
async def some_method(request):
    value = await redis.get('key')
    if value is None:
        value = ...  # Do some work
        await redis.set('key', value, expire=60)
    return value
```

Under the hood, **Muffin-Redis** uses [aioredis](https://github.com/aio-libs/aioredis) for asynchronous Redis support.

## Configuration Options

| Name               | Default               | Description                                                  |
| ------------------ | --------------------- | ------------------------------------------------------------ |
| `url`              | `"redis://localhost"` | Redis connection URL                                         |
| `db`               | `None`                | Redis DB index                                               |
| `password`         | `None`                | Redis password                                               |
| `encoding`         | `"utf-8"`             | Encoding used by the client                                  |
| `poolsize`         | `10`                  | Max pool size (set `0` to disable pooling)                   |
| `decode_responses` | `True`                | Whether to decode binary responses                           |
| `jsonify`          | `False`               | Automatically encode/decode JSON with get/set                |
| `blocking`         | `True`                | Use a blocking connection pool                               |
| `timeout`          | `20`                  | Timeout in seconds for getting a connection                  |
| `redislite`        | `False`               | Enable [redislite](https://github.com/yahoo/redislite) usage |

## Bug Tracker

Please report bugs or feature requests at:
[https://github.com/klen/muffin-redis/issues](https://github.com/klen/muffin-redis/issues)

## Contributing

Development happens at:
[https://github.com/klen/muffin-redis](https://github.com/klen/muffin-redis)

## License

Licensed under the [MIT license](http://opensource.org/licenses/MIT).

## Credits

- Created by [klen](https://github.com/klen) (Kirill Klenov)

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/klen/muffin-redis",
    "name": "muffin-redis",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.10",
    "maintainer_email": null,
    "keywords": "redis, muffin, asgi, asyncio",
    "author": "Kirill Klenov",
    "author_email": "horneds@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/bb/42/60ddea4437ae3873271ffaf5d57a8648539795106789f44e9605f0752073/muffin_redis-3.9.1.tar.gz",
    "platform": null,
    "description": "# Muffin-Redis\n\n**Muffin-Redis** \u2014 Redis support for the [Muffin](https://github.com/klen/muffin) framework.\n\n![Tests Status](https://github.com/klen/muffin-redis/workflows/tests/badge.svg)\n[![PyPI Version](https://img.shields.io/pypi/v/muffin-redis)](https://pypi.org/project/muffin-redis/)\n[![Python Versions](https://img.shields.io/pypi/pyversions/muffin-redis)](https://pypi.org/project/muffin-redis/)\n\n---\n\n## Features\n\n- Built on `redis.asyncio` client.\n- Optional support for `redislite` with Unix socket configuration.\n- JSON serialization support\n- Automatic connection pool management (blocking or non-blocking).\n- Simple `get()` / `set()` with optional `jsonify` flag.\n- Lifecycle support: `startup` and `shutdown` integrate with Muffin app lifecycle.\n\n## Requirements\n\n- Python >= 3.10\n\n## Installation\n\nInstall using pip:\n\n```bash\npip install muffin-redis\n```\n\nOptionally with `redislite`:\n\n```bash\npip install muffin-redis[redislite]\n```\n\n## Usage\n\nSetup the plugin and connect it into your app:\n\n```python\nfrom muffin import Application\nfrom muffin_redis import Plugin as Redis\n\napp = Application('example')\n\n# Initialize the plugin\nredis = Redis(address='redis://localhost')\nredis.setup(app)\n```\n\nYou can now use Redis in your routes:\n\n```python\n@app.route('/some_url', methods=['POST'])\nasync def some_method(request):\n    value = await redis.get('key')\n    if value is None:\n        value = ...  # Do some work\n        await redis.set('key', value, expire=60)\n    return value\n```\n\nUnder the hood, **Muffin-Redis** uses [aioredis](https://github.com/aio-libs/aioredis) for asynchronous Redis support.\n\n## Configuration Options\n\n| Name               | Default               | Description                                                  |\n| ------------------ | --------------------- | ------------------------------------------------------------ |\n| `url`              | `\"redis://localhost\"` | Redis connection URL                                         |\n| `db`               | `None`                | Redis DB index                                               |\n| `password`         | `None`                | Redis password                                               |\n| `encoding`         | `\"utf-8\"`             | Encoding used by the client                                  |\n| `poolsize`         | `10`                  | Max pool size (set `0` to disable pooling)                   |\n| `decode_responses` | `True`                | Whether to decode binary responses                           |\n| `jsonify`          | `False`               | Automatically encode/decode JSON with get/set                |\n| `blocking`         | `True`                | Use a blocking connection pool                               |\n| `timeout`          | `20`                  | Timeout in seconds for getting a connection                  |\n| `redislite`        | `False`               | Enable [redislite](https://github.com/yahoo/redislite) usage |\n\n## Bug Tracker\n\nPlease report bugs or feature requests at:\n[https://github.com/klen/muffin-redis/issues](https://github.com/klen/muffin-redis/issues)\n\n## Contributing\n\nDevelopment happens at:\n[https://github.com/klen/muffin-redis](https://github.com/klen/muffin-redis)\n\n## License\n\nLicensed under the [MIT license](http://opensource.org/licenses/MIT).\n\n## Credits\n\n- Created by [klen](https://github.com/klen) (Kirill Klenov)\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Redis support for Muffin framework.",
    "version": "3.9.1",
    "project_urls": {
        "Homepage": "https://github.com/klen/muffin-redis",
        "Repository": "https://github.com/klen/muffin-redis"
    },
    "split_keywords": [
        "redis",
        " muffin",
        " asgi",
        " asyncio"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b3e3ed679a44e125103c3e0f97b62a464d78065d227c8c35ac5c0706430bc9c9",
                "md5": "c7b2392af2a2c488e4533df94c3270ce",
                "sha256": "3100da3ae6acba8fb12e6886393412da31743fe52b5fa02cbd045f56b6a210cb"
            },
            "downloads": -1,
            "filename": "muffin_redis-3.9.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "c7b2392af2a2c488e4533df94c3270ce",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.10",
            "size": 3942,
            "upload_time": "2025-07-18T09:23:19",
            "upload_time_iso_8601": "2025-07-18T09:23:19.262822Z",
            "url": "https://files.pythonhosted.org/packages/b3/e3/ed679a44e125103c3e0f97b62a464d78065d227c8c35ac5c0706430bc9c9/muffin_redis-3.9.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "bb4260ddea4437ae3873271ffaf5d57a8648539795106789f44e9605f0752073",
                "md5": "b8b194a143d067f51b14b5ab83d19f32",
                "sha256": "f3948da94f5da8d4f913d1a9ae2a6362a209d2d2b598b0691e46e1ba96ce25aa"
            },
            "downloads": -1,
            "filename": "muffin_redis-3.9.1.tar.gz",
            "has_sig": false,
            "md5_digest": "b8b194a143d067f51b14b5ab83d19f32",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.10",
            "size": 3771,
            "upload_time": "2025-07-18T09:23:20",
            "upload_time_iso_8601": "2025-07-18T09:23:20.013027Z",
            "url": "https://files.pythonhosted.org/packages/bb/42/60ddea4437ae3873271ffaf5d57a8648539795106789f44e9605f0752073/muffin_redis-3.9.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-18 09:23:20",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "klen",
    "github_project": "muffin-redis",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "muffin-redis"
}
        
Elapsed time: 1.87929s