icemanpro
V2EX  ›  问与答

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

  •  
  •   icemanpro · Sep 28, 2025 · 1184 views
    This topic created in 227 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   ·   3248 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 46ms · UTC 12:16 · PVG 20:16 · LAX 05:16 · JFK 08:16
    ♥ Do have faith in what you're doing.