muffin-redis


Namemuffin-redis JSON
Version 3.7.1 PyPI version JSON
download
home_pagehttps://github.com/klen/muffin-redis
SummaryRedis support for Muffin framework.
upload_time2023-11-07 15:32:24
maintainer
docs_urlNone
authorKirill Klenov
requires_python>=3.8,<4.0
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
############

.. _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.8

.. _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": "",
    "docs_url": null,
    "requires_python": ">=3.8,<4.0",
    "maintainer_email": "",
    "keywords": "redis,muffin,asgi,asyncio",
    "author": "Kirill Klenov",
    "author_email": "horneds@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/a1/0c/aaa5008b14afde4b3f1b6cbfe0bca38030e14919ada4564f7a511b4945d9/muffin_redis-3.7.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.8\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.7.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": "cda13a4983be7fd9ddeb75f1ee7aafcd4487c9201675f18e7b626c54e06430da",
                "md5": "c12062477e16f2ecfd1b7d67c7873a33",
                "sha256": "690fa35f11308d1dd24149b7a0d81bb1134dffc6856ea22eab7b121c9d9f2e3b"
            },
            "downloads": -1,
            "filename": "muffin_redis-3.7.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "c12062477e16f2ecfd1b7d67c7873a33",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8,<4.0",
            "size": 3885,
            "upload_time": "2023-11-07T15:32:23",
            "upload_time_iso_8601": "2023-11-07T15:32:23.352182Z",
            "url": "https://files.pythonhosted.org/packages/cd/a1/3a4983be7fd9ddeb75f1ee7aafcd4487c9201675f18e7b626c54e06430da/muffin_redis-3.7.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a10caaa5008b14afde4b3f1b6cbfe0bca38030e14919ada4564f7a511b4945d9",
                "md5": "6c6fcd435c5b01ab1dabf6369fdb3d23",
                "sha256": "179624609d58d2204916571651f8bb079caa2d6a99345070af331fffa1ecbf3e"
            },
            "downloads": -1,
            "filename": "muffin_redis-3.7.1.tar.gz",
            "has_sig": false,
            "md5_digest": "6c6fcd435c5b01ab1dabf6369fdb3d23",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8,<4.0",
            "size": 3808,
            "upload_time": "2023-11-07T15:32:24",
            "upload_time_iso_8601": "2023-11-07T15:32:24.967899Z",
            "url": "https://files.pythonhosted.org/packages/a1/0c/aaa5008b14afde4b3f1b6cbfe0bca38030e14919ada4564f7a511b4945d9/muffin_redis-3.7.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-11-07 15:32:24",
    "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: 0.15229s