又一个内存缓存包
yamicache的Python项目详细描述
山药
又一个内存缓存包
- 自由软件:麻省理工学院许可证
- 文档:https://yamicache.readthedocs.io。
功能
- 备忘录
- 基于decorators的选择性缓存
- 多螺纹支架
- 可选垃圾收集线程
- 可选的基于时间的缓存过期时间
快速启动
from__future__importprint_functionimporttimefromyamicacheimportCachec=Cache()classMyApp(object):@c.cached()deflong_op(self):time.sleep(30)return1app=MyApp()t_start=time.time()assertapp.long_op()==1# takes 30sassertapp.long_op()==1# takes 0sassertapp.long_op()==1# takes 0sassert1<(time.time()-t_start)<31
历史记录
0.5.1(2018-04-10)
- 修复8:未处理函数默认参数。还有一个 如果python更改了dict键的顺序,则可能会导致缓存未命中。
0.5.0(2018-03-23)
- 修正7:刷新时不返回超时值
0.4.0(2017-10-09)
- 添加了serialize()和deserialize()
0.3.0(2017-09-05)
- 添加了@clear_cache()decorator
- 添加了允许from yamicache import Cache 的导入
0.2.0(2017-09-03)
- 添加了缓存键冲突检查
0.1.1(2017-09-01)
- 修正1:Cache.cached()忽略timeout参数
0.1.0(2017-08-28)
- pypi上的第一个版本。