V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
wico77
V2EX  ›  Python

python 如何把函数结果缓存到硬盘系统?

  •  
  •   wico77 · 2016-01-25 17:37:36 +08:00 · 2145 次点击
    这是一个创建于 3028 天前的主题,其中的信息可能已经有所发展或是发生改变。

    看到一篇文章,把函数结果缓存到内存,文章原文 http://caiknife.github.io/blog/2013/08/13/python-decorator/
    我的问题是能不能把函数结果缓存到硬盘,因为如果对于搜索站,查询词太多的话对内存要求太高,能缓存到硬盘就好了。

    5 条回复    2016-01-26 02:09:56 +08:00
    virusdefender
        1
    virusdefender  
       2016-01-25 17:41:44 +08:00
    pickle
    wico77
        2
    wico77  
    OP
       2016-01-25 17:49:34 +08:00
    @virusdefender pickle 是持久化保持结果,有没有能设置缓存时间的
    paulw54jrn
        3
    paulw54jrn  
       2016-01-25 18:45:31 +08:00
    直接 Redis 解决?
    virusdefender
        4
    virusdefender  
       2016-01-25 18:59:22 +08:00
    @wico77 那应该是文件系统的问题了
    tinyproxy
        5
    tinyproxy  
       2016-01-26 02:09:56 +08:00 via iPhone
    @wico77 那你检查缓存文件的修改时间啊,超过 ttl 删了重跑就是了
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   3313 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 11:27 · PVG 19:27 · LAX 04:27 · JFK 07:27
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.