一个简单的muffin框架的dogpilecache助手插件
muffin-dogpilecache的Python项目详细描述
muffin dogpilecache–一个用于muffin框架的简单dogpilecache辅助插件。
要求
- python=3.4
- 松饼=0.5.5
安装
muffin dogpilecache应该使用pip安装:
pip install muffin-dogpilecache
用法
将muffin dogpilecache添加到muffin插件列表:
importmuffinapp=muffin.Application('example',PLUGINS=('muffin_dogpilecache',))
为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,}
将每个配置与dogpile.cache区域关联:
DOGPILECACHE_REGIONS={'default':'cache.local.','redis':'cache.redis.',}
装饰您的功能:
@app.ps.dogpilecache.default.cache_on_arguments()defmy_local_cached_function():...@app.ps.dogpilecache.redis.cache_on_arguments()defmy_redis_cached_function():...
选项
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 |
许可证
根据MIT license授权。