有Python缓存库吗? [英] Is there a Python caching library?

查看:109
本文介绍了有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?

推荐答案

看看烧杯:


  • 首页

  • 缓存文档

  • < a href = http://www.groovie.org/blog/advanced-caching-with-django-and-beaker rel = noreferrer>关于在Django上使用Beaker的快速入门文章(但在其他文章中很有用)应用程序)

  • Home Page
  • Caching Documentation
  • Good quick-start article about using Beaker with Django (but useful in any other apps too)

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

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆