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

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.3.0.tar.gz (5.0 kB view details)

Uploaded Source

Built Distribution

muffin_redis-3.3.0-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: muffin-redis-3.3.0.tar.gz
  • Upload date:
  • Size: 5.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for muffin-redis-3.3.0.tar.gz
Algorithm Hash digest
SHA256 ad898fa22d332c12f2c09021597b0782f4f4ced3975b7246340227971316f193
MD5 f5f9d8a1aafb623d762bf5f9088b7df5
BLAKE2b-256 cbfbc65c54aab7f4acd9784db1cf2e697d9acd3e74040e1aea4ca255df02ea4b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for muffin_redis-3.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5a7167f9549035eaf424e1a0f527319571b88a5c668d82d9162bcb8787763de6
MD5 8cd229bff420f610ac96dd0fd55ebecb
BLAKE2b-256 b5b7b7f3081457c9406ab8fb2b7c49339822a58e10a0b4d4817d0566428ac80f

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