• 请不要在回答技术问题时复制粘贴 AI 生成的内容
licoycn
V2EX  ›  程序员

关于 SpringBoot 的 Redis 查询不到问题

  •  
  •   licoycn ·
    Licoy · Oct 13, 2020 · 1375 views
    This topic created in 2128 days ago, the information mentioned may be changed or developed.

    SpringBoot 的 RedisTemplate 有时候在进行 hash 查询的时候查询为空

    排查:开启 redis 客户端的 monitor,在进行到对应的业务时没有看到查询监控,所以实际是没有去真实进行查询,而是直接返回空,再进行其他的操作就有查询监控了。

    版本:
    springboot:2.1.12.RELEASE
    jedis:2.9.3
    kryo:4.0.2
    
    wakzz
        1
    wakzz  
       Oct 13, 2020
    抓个包看一下,怀疑是 RedisTemplate 的 hash key 的序列化没设置好,用的默认 JDK 序列化导致序列化值和 redis 中的 key 不一致导致的。
    licoycn
        2
    licoycn  
    OP
       Oct 13, 2020
    @wakzz hash 的 key 和 value 序列化都用的 kryo
    wakzz
        3
    wakzz  
       Oct 14, 2020
    @licoycn 存得进去么?自己存的值自己能取么?如果能存进去,取不到,大概率是序列化的锅
    licoycn
        4
    licoycn  
    OP
       Oct 14, 2020
    @wakzz 现在已经更换了 lettuce
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1045 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 23:02 · PVG 07:02 · LAX 16:02 · JFK 19:02
    ♥ Do have faith in what you're doing.