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

feat: Efficient caching #37

Merged
merged 3 commits into from
May 19, 2024
Merged

feat: Efficient caching #37

merged 3 commits into from
May 19, 2024

Conversation

KenyonY
Copy link
Owner

@KenyonY KenyonY commented May 19, 2024

高效的缓存设置,当操作 value = db['key']value = db.get('key)
将直接返回对db中'key'的缓存引用,在短时间内(一秒内)操作value会直接改变db的值。
如value是个字典,可以直接对value['xx'] = xxx
但这份缓存一般只会存在1秒钟,超过这个时间周期后操作value对象将不会更新到db。
更通用的写法是: db['key']['xx'] = xxx 可以确保值被正确更新至db。

@KenyonY KenyonY merged commit 3482096 into main May 19, 2024
3 checks passed
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

Successfully merging this pull request may close these issues.

1 participant