本文介绍了是否有 Python 缓存库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一个 Python 缓存库,但目前找不到任何东西.我需要一个类似 dict 的简单界面,我可以在其中设置键和它们的到期时间,并将它们恢复缓存.有点像:

I'm looking for a Python caching library but can't find anything so far. I need a simple dict-like interface where I can set keys and their expiration and get them back cached. Sort of something like:

cache.get(myfunction, duration=300)

如果它存在,它将从缓存中给我项目,或者调用该函数并存储它,如果它不存在或已经过期.有人知道这样的吗?

which will give me the item from the cache if it exists or call the function and store it if it doesn't or has expired. Does anyone know something like this?

推荐答案

看看 Beaker:

这篇关于是否有 Python 缓存库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-24 04:03