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

Go防缓存击穿 singleflight | 薛定谔の猫 #36

Open
bineyond opened this issue Jan 15, 2021 · 0 comments
Open

Go防缓存击穿 singleflight | 薛定谔の猫 #36

bineyond opened this issue Jan 15, 2021 · 0 comments

Comments

@bineyond
Copy link
Owner

https://ubin.top/2020/03/15/Go%E9%98%B2%E7%BC%93%E5%AD%98%E5%87%BB%E7%A9%BFsingleflight/

缓存更新问题缓存是高并发业务的基石,当访问量突然上升的时候,缓存失效回源时会将请求打到后台数据库,导致服务器响应延迟或者宕机的情况。 通常缓存更新方案: 1.业务代码中,根据key从缓存拿不到数据,访问存储层获取数据后更新缓存 2.由专门的定时脚本在缓存失效前对其进行更新 3.通过分布式锁,实现只有一个请求负责缓存更新,其他请求等待:一种基于哨兵的缓存访问策略 通常获取缓存这样写: 1234d

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

No branches or pull requests

1 participant