Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python项目的缓存方案 #3

Open
Guo-Zhang opened this issue May 20, 2023 · 2 comments
Open

Python项目的缓存方案 #3

Guo-Zhang opened this issue May 20, 2023 · 2 comments

Comments

@Guo-Zhang
Copy link
Member

Guo-Zhang commented May 20, 2023

我注意到 @huangrihang 经常增加一些计数变量。类似的需求,我们有必要规范缓存方案。

根据StackOverflow的回答,有几个备选方案:

  1. 标准库functoolslru_cache。它的功能似乎不是我们直接需要的。

Decorator to wrap a function with a memoizing callable that saves up to the maxsize most recent calls. It can save time when an expensive or I/O bound function is periodically called with the same arguments.

  1. 不过有基于它直接实现的库,比如cachetools

  2. beaker: 这是一个用在Web应用的缓存框架。

  3. pymemcache也是一个比较主流的方案。

  4. cachesql: SQL缓存。

@Guo-Zhang
Copy link
Member Author

其他相关项目:https://pypi.org/project/requests-cache/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant