Muffin-Redis
############
.. _description:
Muffin-Redis -- Redis support for Muffin framework.
.. _badges:
.. image:: https://github.com/klen/muffin-redis/workflows/tests/badge.svg
:target: https://github.com/klen/muffin-redis/actions
:alt: Tests Status
.. image:: https://img.shields.io/pypi/v/muffin-redis
:target: https://pypi.org/project/muffin-redis/
:alt: PYPI Version
.. image:: https://img.shields.io/pypi/pyversions/muffin-redis
:target: https://pypi.org/project/muffin-redis/
:alt: Python Versions
.. _contents:
.. contents::
.. _requirements:
Requirements
=============
- python >= 3.9
.. _installation:
Installation
=============
**Muffin-Redis** should be installed using pip: ::
pip install muffin-redis
Optionally you may install the plugin with redislite: ::
$ pip install muffin-redis[redislite]
.. _usage:
Usage
=====
Setup the plugin and connect it into your app:
.. code-block:: python
from muffin import Application
from muffin_redis import Plugin as Redis
# Create Muffin Application
app = Application('example')
# Initialize the plugin
# As alternative: redis = Redis(app, **options)
redis = Redis(address='redis://localhost')
redis.setup(app)
That's it now you are able to use the plugin inside your views:
.. code-block:: python
@app.route('/some_url', methods=['POST'])
async def some_method(request):
"""Work with redis."""
value = await redis.get('key')
if value is None:
value = ... # Do some work
await redis.set('key', value, expire=60)
return value
For Asyncio_ the ``muffin-redis`` uses aioredis_ library. So check the
library's docs for futher reference.
.. _Asyncio: https://docs.python.org/3/library/asyncio.html
.. _aioredis: https://github.com/aio-libs/aioredis
Configuration options
----------------------
=========================== ======================================= ===========================
Name Default value Description
--------------------------- --------------------------------------- ---------------------------
**url** ``"redis://localhost"`` Redis connection URL
**db** ``None`` Number of the Redis DB
**password** ``None`` Connection password
**encoding** ``"utf-8"`` Connection encoding
**poolsize** ``10`` Connections pool size (set 0 to disable pooling)
**decode_responses** ``True`` Decode binary responses
**jsonify** ``False`` Use json to store/read objects with get/set
**blocking** ``True`` Wait for an available connection
**timeout** ``20`` Timeout to get a connection
**redislite** ``False`` Use redislite instead of redis
=========================== ======================================= ===========================
.. _bugtracker:
Bug tracker
===========
If you have any suggestions, bug reports or
annoyances please report them to the issue tracker
at https://github.com/klen/muffin-redis/issues
.. _contributing:
Contributing
============
Development of Muffin-Redis happens at: https://github.com/klen/muffin-redis
Contributors
=============
* klen_ (Kirill Klenov)
.. _license:
License
========
Licensed under a `MIT license`_.
.. _links:
.. _klen: https://github.com/klen
.. _MIT license: http://opensource.org/licenses/MIT
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.9",
"maintainer_email": null,
"keywords": "redis, muffin, asgi, asyncio",
"author": "Kirill Klenov",
"author_email": "horneds@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/a5/57/344229a0be47888f29f3729576622aa418ac74bc6e66346b7f1fba5d43a5/muffin_redis-3.8.1.tar.gz",
"platform": null,
"description": "Muffin-Redis\n############\n\n.. _description:\n\nMuffin-Redis -- Redis support for Muffin framework.\n\n.. _badges:\n\n.. image:: https://github.com/klen/muffin-redis/workflows/tests/badge.svg\n :target: https://github.com/klen/muffin-redis/actions\n :alt: Tests Status\n\n.. image:: https://img.shields.io/pypi/v/muffin-redis\n :target: https://pypi.org/project/muffin-redis/\n :alt: PYPI Version\n\n.. image:: https://img.shields.io/pypi/pyversions/muffin-redis\n :target: https://pypi.org/project/muffin-redis/\n :alt: Python Versions\n\n.. _contents:\n\n.. contents::\n\n.. _requirements:\n\nRequirements\n=============\n\n- python >= 3.9\n\n.. _installation:\n\nInstallation\n=============\n\n**Muffin-Redis** should be installed using pip: ::\n\n pip install muffin-redis\n\nOptionally you may install the plugin with redislite: ::\n\n $ pip install muffin-redis[redislite]\n\n.. _usage:\n\nUsage\n=====\n\nSetup the plugin and connect it into your app:\n\n.. code-block:: python\n\n from muffin import Application\n from muffin_redis import Plugin as Redis\n\n # Create Muffin Application\n app = Application('example')\n\n # Initialize the plugin\n # As alternative: redis = Redis(app, **options)\n redis = Redis(address='redis://localhost')\n redis.setup(app)\n\nThat's it now you are able to use the plugin inside your views:\n\n.. code-block:: python\n\n @app.route('/some_url', methods=['POST'])\n async def some_method(request):\n \"\"\"Work with redis.\"\"\"\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\n return value\n\nFor Asyncio_ the ``muffin-redis`` uses aioredis_ library. So check the\nlibrary's docs for futher reference.\n\n.. _Asyncio: https://docs.python.org/3/library/asyncio.html\n.. _aioredis: https://github.com/aio-libs/aioredis\n\nConfiguration options\n----------------------\n\n=========================== ======================================= ===========================\nName Default value Description\n--------------------------- --------------------------------------- ---------------------------\n**url** ``\"redis://localhost\"`` Redis connection URL\n**db** ``None`` Number of the Redis DB\n**password** ``None`` Connection password\n**encoding** ``\"utf-8\"`` Connection encoding\n**poolsize** ``10`` Connections pool size (set 0 to disable pooling)\n**decode_responses** ``True`` Decode binary responses\n**jsonify** ``False`` Use json to store/read objects with get/set\n**blocking** ``True`` Wait for an available connection\n**timeout** ``20`` Timeout to get a connection\n**redislite** ``False`` Use redislite instead of redis\n=========================== ======================================= ===========================\n\n.. _bugtracker:\n\nBug tracker\n===========\n\nIf you have any suggestions, bug reports or\nannoyances please report them to the issue tracker\nat https://github.com/klen/muffin-redis/issues\n\n.. _contributing:\n\nContributing\n============\n\nDevelopment of Muffin-Redis happens at: https://github.com/klen/muffin-redis\n\n\nContributors\n=============\n\n* klen_ (Kirill Klenov)\n\n.. _license:\n\nLicense\n========\n\nLicensed under a `MIT license`_.\n\n.. _links:\n\n.. _klen: https://github.com/klen\n.. _MIT license: http://opensource.org/licenses/MIT\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Redis support for Muffin framework.",
"version": "3.8.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": "8fa283ad2527917c29ec35fec941e6f870eb6d9b8396cabf4dcf7fd78043b476",
"md5": "b6ab47aa47e9a9f8b293bcf9feee8b37",
"sha256": "b1c414beb08085ff255308966042635ae0dfdf4b032a6afc75584462d4122221"
},
"downloads": -1,
"filename": "muffin_redis-3.8.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "b6ab47aa47e9a9f8b293bcf9feee8b37",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.9",
"size": 3904,
"upload_time": "2024-07-31T22:50:35",
"upload_time_iso_8601": "2024-07-31T22:50:35.303843Z",
"url": "https://files.pythonhosted.org/packages/8f/a2/83ad2527917c29ec35fec941e6f870eb6d9b8396cabf4dcf7fd78043b476/muffin_redis-3.8.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "a557344229a0be47888f29f3729576622aa418ac74bc6e66346b7f1fba5d43a5",
"md5": "01dc8f724dbe1a52061c293d85cc52a6",
"sha256": "f4cdb71d436842d27a37279a4872e5c3b028822dca3c468010952dae9e0dfdee"
},
"downloads": -1,
"filename": "muffin_redis-3.8.1.tar.gz",
"has_sig": false,
"md5_digest": "01dc8f724dbe1a52061c293d85cc52a6",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.9",
"size": 3830,
"upload_time": "2024-07-31T22:50:37",
"upload_time_iso_8601": "2024-07-31T22:50:37.519047Z",
"url": "https://files.pythonhosted.org/packages/a5/57/344229a0be47888f29f3729576622aa418ac74bc6e66346b7f1fba5d43a5/muffin_redis-3.8.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-07-31 22:50:37",
"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"
}