Skip to main content

Redis support for Muffin framework.

Project description

Muffin-Redis – Redis support for Muffin framework.

Tests Status PYPI Version Python Versions

Requirements

  • python >= 3.7

Installation

Muffin-Redis should be installed using pip:

pip install muffin-redis

To install fakeredis (for testing purposes):

pip install muffin-redis[fake]

Usage

Setup the plugin and connect it into your app:

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:

@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.

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

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

Development of Muffin-Redis happens at: https://github.com/klen/muffin-redis

Contributors

  • klen (Kirill Klenov)

License

Licensed under a MIT license.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

muffin-redis-3.0.2.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

muffin_redis-3.0.2-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

Details for the file muffin-redis-3.0.2.tar.gz.

File metadata

  • Download URL: muffin-redis-3.0.2.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for muffin-redis-3.0.2.tar.gz
Algorithm Hash digest
SHA256 d9333ca410759de6f93c4a7f311d932001fe24a653913a5c1170e4832cfa0b31
MD5 86f1fbbea54cdd6fb265fe2556ca3d97
BLAKE2b-256 77a45a7757c108b36ed33309c377134040e6f5fdc994448a09e5a345536c6a6a

See more details on using hashes here.

File details

Details for the file muffin_redis-3.0.2-py3-none-any.whl.

File metadata

  • Download URL: muffin_redis-3.0.2-py3-none-any.whl
  • Upload date:
  • Size: 4.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for muffin_redis-3.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b184e76b937c1403e9d46a96d8116a2d71a0a4195b9020de3324f419dfe4d2a9
MD5 dce75994982bf6ed83f9a228db6784e9
BLAKE2b-256 816bd0f58bc5a52db7ca438369105e7e68ca6db680dfb8b60de3f9636b0274cc

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page