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

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

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

redislite

False

Use redislite instead of redis

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

Uploaded Source

Built Distribution

muffin_redis-3.8.1-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

Details for the file muffin_redis-3.8.1.tar.gz.

File metadata

  • Download URL: muffin_redis-3.8.1.tar.gz
  • Upload date:
  • Size: 3.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.10.12 Linux/6.5.0-1024-azure

File hashes

Hashes for muffin_redis-3.8.1.tar.gz
Algorithm Hash digest
SHA256 f4cdb71d436842d27a37279a4872e5c3b028822dca3c468010952dae9e0dfdee
MD5 01dc8f724dbe1a52061c293d85cc52a6
BLAKE2b-256 a557344229a0be47888f29f3729576622aa418ac74bc6e66346b7f1fba5d43a5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: muffin_redis-3.8.1-py3-none-any.whl
  • Upload date:
  • Size: 3.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.10.12 Linux/6.5.0-1024-azure

File hashes

Hashes for muffin_redis-3.8.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b1c414beb08085ff255308966042635ae0dfdf4b032a6afc75584462d4122221
MD5 b6ab47aa47e9a9f8b293bcf9feee8b37
BLAKE2b-256 8fa283ad2527917c29ec35fec941e6f870eb6d9b8396cabf4dcf7fd78043b476

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