金字塔的dogpile.cache工厂
pyramid_dogpile_cache的Python项目详细描述
简介
pyramid_dogpile_cache是金字塔的一个小型dogpile缓存工厂。
设置
把config.include('pyramid_dogpile_cache')放在启动代码中的某个位置:
config=Configurator(...)config.include('pyramid_dogpile_cache')
或者您也可以将pyramid_dogpile_cache添加到配置中的pyramid.includes列表:
pyramid.includes=pyramid_dogpile_cache
代码中的用法
pyramid_dogpile_cache.get_region是唯一的api。
frompyramid_dogpile_cacheimportget_regionregion=get_region('foo')# ... do whatever operation on the cache region ...
设置
dogpile_cache.regions
A list of region names to initialize through the factory. Regions can be separated by either spaces or commas.
dogpile_cache.backend
The default backend for cache regions. You can later override it with the region-specific setting.
dogpile_cache.expire
The default expiration time for cache regions. You can later override it with the region-specific setting.
dogpile_cache.arguments.*
The arguments for the default backend. You can later override it with the region-specific setting.
dogpile_cache.function_key_generator
Passed to ^{tt11}$.
dogpile_cache.key_mangler
Passed to ^{tt11}$.
dogpile_cache.async_creation_runner
Passed to ^{tt11}$.
dogpile_cache.REGION.*
Each set of region-specific settings is prefixed with the region name followed by the setting name. For example, settings for region ^{tt17}$ can be like the following:
; global settingsdogpile_cache.backend=file; settings for foodogpile_cache.foo.backend=redisdogpile_cache.foo.arguments.host=127.0.0.1dogpile_cache.foo.arguments.port=6379dogpile_cache.foo.arguments.db=0dogpile_cache.foo.arguments.redis_expiration_time=7200dogpile_cache.foo.arguments.distributed_lock=1
贡献者
- 森吉小泉
更改日志
0.0.1
- 首次发布
0.0.2
- 小文档修复
0.0.3
- 许可证包含(MIT)
0.0.4
- 包装修复程序