跳转到主要内容

可调用对象的自动缓存和缓存失效

项目描述

Travis Codecov PyPI License Python versions PyPI downloads per month

PySmartCache

PySmartCache是一个带有激光的记忆化器实现。

思路很简单:您只需使用@cache()装饰您的方法/函数,PySmartCache将处理其他一切(基于参数的缓存、缓存失效、缓存清除、缓存刷新和缓存失效的帮助器等)。

例如,将这个

def calculate_universe_mass(some_parameter, another_parameter, whatever):
    return 42

改为这个

from pysmartcache import cache
@cache()
def calculate_universe_mass(some_parameter, another_parameter, whatever):
    return 42

严肃的。就是这样。=P

有关更多详细信息,请参阅文档

开发

运行代码检查器

pip install -r requirements_dev.txt
isort -rc .
tox -e lint

通过tox运行测试

pip install -r requirements_dev.txt
tox

发布新的大/小/修补程序版本

pip install -r requirements_dev.txt
bump2version <PART>  # <PART> can be either 'patch' or 'minor' or 'major'

上传到PyPI

pip install -r requirements_dev.txt
python setup.py sdist bdist_wheel
python -m twine upload dist/*

贡献

如果您发现一个问题,请打开问题,或者在可能的情况下创建拉取请求。如果是拉取请求,请考虑以下事项

  • 尊重行长度(132个字符)
  • 编写自动测试
  • 在本地运行tox,以便您可以查看是否一切正常(包括代码检查器和其他Python版本)

项目详情


下载文件

下载适用于您平台文件。如果您不确定选择哪个,请了解有关安装包的更多信息。

源代码分发

pysmartcache-3.0.1.tar.gz (5.1 kB 查看散列值)

上传时间 源代码

构建分发

pysmartcache-3.0.1-py3-none-any.whl (6.1 kB 查看散列值)

上传时间 Python 3

由...