Cnfzh 软件博客

缓存三问:在哪、多久、怎么失效

内存缓存、分布式缓存与浏览器缓存的取舍。

在哪

单机用内存缓存,多实例上分布式。别一上来就 Redis。

多久

TTL 与业务语义对齐:配置类可以长,统计类必须短。

怎么失效

写时删是最稳的方案。主动更新容易留下不一致窗口。

评论 0

还没有评论,来说两句吧。

提交前需验证邮箱,验证码 10 分钟内有效。

Rejoining the server...

Rejoin failed... trying again in seconds.

Failed to rejoin.
Please retry or reload the page.

The session has been paused by the server.

Failed to resume the session.
Please retry or reload the page.