Muffin-DogpileCache -- A simple DogpileCache helper plugin for muffin framework.
- python >= 3.4
- muffin >= 0.5.5
Muffin-DogpileCache should be installed using pip: :
pip install muffin-dogpilecache
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():
...
Option | Description |
---|---|
|
Configurations for regions |
|
Regions related with the configurations prefix |
|
If true, set regions with dogpile.cache.null |
|
A function to generate custom cache keys |
Licensed under a MIT license.