V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
icemanpro
V2EX  ›  问与答

nestjs 中,用 redis 做缓存,现 funA()调用 funB(),funA()和 funB()都有各自的缓存,当 funB()缓存失效时,如何自动失效 funA()的缓存

  •  
  •   icemanpro · Sep 28, 2025 · 1153 views
    This topic created in 213 days ago, the information mentioned may be changed or developed.
    1 replies    2025-09-28 11:56:50 +08:00
    javalaw2010
        1
    javalaw2010  
       Sep 28, 2025
    要么 A/B 只做一个的缓存,要么 B 支持传入一个 context string ,保证同样的 func 在不同的上下文中的 cache key 不一样。其他方案都太复杂了,不建议研究。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3233 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 32ms · UTC 11:56 · PVG 19:56 · LAX 04:56 · JFK 07:56
    ♥ Do have faith in what you're doing.