用于缓存的具有自动过期值的字典
ttldict的Python项目详细描述
带密钥到期时间的python字典
orderedtldict的行为类似于您知道的有序dict。 方法在清除过期对象后返回对象列表 物体。方法keys作为parnet类返回 所以在清除过期密钥之后。 python自己的orderedict和其他字典返回一个[字典视图][1] 而这里的方法没有。
测试
使用pytest运行测试:
` make test `
学分和感谢:
- expiringdict的邮箱
- 托马斯·肯默 https://github.com/tkem/cachetools
还有Jyrki Muukkonen 发表于https://github.com/jvtm/ttldict。
此库包含其ttldict类的修复程序 还有我自己订的。
没有这些,这项工作是不可能的。
[1]:https://docs.python.org/3/library/stdtypes.html#dictionary-view-objects