Skip to main content

A simple DogpileCache helper plugin for muffin framework

Project description

Muffin-DogpileCache – A simple DogpileCache helper plugin for muffin framework.

Requirements

  • python >= 3.4

  • muffin >= 0.5.5

Installation

Muffin-DogpileCache should be installed using pip:

pip install muffin-dogpilecache

Usage

Add muffin-dogpilecache to muffin plugin list:

import muffin


app = muffin.Application(
    'example',

    PLUGINS=(
        'muffin_dogpilecache',
    )
)

Add your configurations for dogpile.cache:

DOGPILECACHE_CONFIGS = {
    'cache.local.backend': 'dogpile.cache.dbm',
    'cache.local.arguments.filename': './dbmfile.dbm',
    'cache.redis.backend': 'dogpile.cache.redis',
    'cache.redis.arguments.host': 'localhost',
    'cache.redis.arguments.port': 6379,
}

Associate each configuration with a dogpile.cache region:

DOGPILECACHE_REGIONS = {
    'default': 'cache.local.',
    'redis': 'cache.redis.',
}

Decorate your functions:

@app.ps.dogpilecache.default.cache_on_arguments()
def my_local_cached_function():
    ...

@app.ps.dogpilecache.redis.cache_on_arguments()
def my_redis_cached_function():
    ...

Options

Option

Description

DOGPILECACHE_CONFIGS

Configurations for regions

DOGPILECACHE_REGIONS

Regions related with the configurations prefix

DOGPILECACHE_TEST

If true, set regions with dogpile.cache.null

DOGPILECACHE_FUNCTION_KEY_GENERATOR

A function to generate custom cache keys

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-dogpilecache-0.0.2.tar.gz (3.6 kB view details)

Uploaded Source

File details

Details for the file muffin-dogpilecache-0.0.2.tar.gz.

File metadata

File hashes

Hashes for muffin-dogpilecache-0.0.2.tar.gz
Algorithm Hash digest
SHA256 b11eecb8c28503ac2b0266b18c6dc97e22d98dde3cdbf8fb10de44a6c2764e21
MD5 db92244886086a4d6e631cf1c9084554
BLAKE2b-256 00934aa02f38f97951db2c90722260f1caaace45207f521ebc8896c9d256a372

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