使用改进的pickling将任何python对象缓存到文件中。

anycache的Python项目详细描述


https://badge.fury.io/py/anycache.svghttps://travis-ci.org/c0fec0de/anycache.svg?branch=masterhttps://coveralls.io/repos/github/c0fec0de/anycache/badge.svghttps://readthedocs.org/projects/anycache/badge/?version=2.0.6https://codeclimate.com/github/c0fec0de/anycache.pnghttps://img.shields.io/pypi/pyversions/anycache.svghttps://landscape.io/github/c0fec0de/anycache/master/landscape.svg?style=flathttps://img.shields.io/badge/code%20style-pep8-brightgreen.svghttps://img.shields.io/badge/code%20style-pep257-brightgreen.svg

使用改进的pickling将任何python对象缓存到文件中

开始

要缓存函数的结果,请使用全局无限制anycache:

>>> from anycache import anycache
>>> @anycache()
... def myfunc(posarg, kwarg=3):
...     print("  Calcing %r + %r = %r" % (posarg, kwarg, posarg + kwarg))
...     return posarg + kwarg
>>> myfunc(8, 5)
  Calcing 8 + 5 = 13
13
>>> myfunc(8, 5)
13

anycache缓存几乎所有python对象。还有lambda语句。 它使用Dill作为后端。改进版的Python内置泡菜。

为了在多个python运行之间保留结果,一个持久缓存 需要设置目录。

>>> from anycache import anycache
>>> @anycache(cachedir='/tmp/anycache.my')
... def myfunc(posarg, kwarg=3):
...     return posarg + kwarg

anycache对象为缓存清除和 尺寸处理。

安装

要安装anycache模块,请运行:

pip install anycache

如果您没有python安装的写权限,请尝试:

pip install anycache --user

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java在TextView中对齐部分文本   带有iText和eTPKCS11的java PKCS#11签名。dll&SunPKCS11提供程序   java Intellij Idea找不到jar   java Chrome/Firefox和Jetty HTTPS   java我无法打包找不到的JavaFX应用程序模块   多线程Java:排序从异步任务检索的结果   java客户端/服务器socket不能与外部连接一起工作   java如何在单击“下一步”按钮时获取其他详细信息?   java组织。springframework。网状物客户RestTemplate应声明为@Bean,而plain@Autowired抛出错误   java如何绘制javax。摆动将ImageIcon转换为JavaFX。fxml呈现用户界面?   使用for循环的Java跟踪   java如何编码字符串以显示彩色文本(基于字符串中的前缀)   Java保存/打开文件对象   基于java复选框的搜索:使用尽可能多的“”动态生成准备好的语句作为选中复选框的计数   java为什么crawler4j随机挂起?