Cnfzh 软件博客

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

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

在哪

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

多久

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

怎么失效

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

Comments 0

No comments yet. Say something!

Email verification is required; the code is valid for 10 minutes.

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.