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

refactor: 使用otter缓存替代buntdb,并借助context对除SQLITE以外的数据库进行细粒度缓存 #1189

Merged
merged 5 commits into from
Jan 17, 2025

Conversation

PaienNate
Copy link
Contributor

如题,otter缓存: https://github.com/maypok86/otter;

基于对缓存和并发数据结构的研究,Otter 是 Go 最强大的缓存库之一。 Otter还借鉴了其他语言(例如caffeine )设计缓存库的经验。

同时,我现在以context创建data,logs,censor的gorm.DB,从而可以在缓存清理时,针对data/logs/censor的不同进行缓存清理,这样能增加缓存命中率。

注:由于sqlite是物理分割的,所以这个优化似乎只对PG和MYSQL有效。

另外针对Init,对应的代码要求传入context,为以后可以使用超时关闭数据库的context做准备(待定,现在反正直接传递了context.Background())

@fy0
Copy link
Member

fy0 commented Jan 9, 2025

emmm 鉴于暂时不好验证后果 又因为nn问题 我们明后天发一个新的测试版 然后再合并吧

@PaienNate
Copy link
Contributor Author

emmm 鉴于暂时不好验证后果 又因为nn问题 我们明后天发一个新的测试版 然后再合并吧

我也是这么想的,那先去build个新版? issue那边的用户嗷嗷待包中.jpg

@PaienNate PaienNate requested a review from fy0 January 17, 2025 01:49
@fy0 fy0 merged commit 0b04a23 into sealdice:master Jan 17, 2025
2 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.

3 participants