Unable to retrieve persisted data with spring data redis

huangapple go评论41阅读模式
英文:

Unable to retrieve persisted data with spring data redis

问题

I am new to redis but understand the fundamentals. I am trying to add users to a list that have joined a chatroom. I am using the RedisTemplate from spring data redis.

Added is done via: redisTemplate.opsForList().rightPush("voting", user.getName());

On the redis server using KEYS * returns: 2) "\xac\xed\x00\x05t\x00\x06voting"

However using: GET and I keep seeing nil using:

  • "\xac\xed\x00\x05t\x00\x06voting"
  • "voting"

as keys.

I'm not sure what the prefix of \xac\xed\x00\x05t\x00\x06 is? Could anyone explain. Thanks

英文:

I am new to redis but understand the fundamentals. I am trying to add users to a list that have joined a chatroom. I am using the RedisTemplate from spring data redis.

Added is done via: redisTemplate.opsForList().rightPush("voting", user.getName());

On the redis server using KEYS * returns: 2) "\xac\xed\x00\x05t\x00\x06voting"

However using: GET and I keep seeing nil using:

  • \xac\xed\x00\x05t\x00\x06voting
  • voting

as keys.

I'm not sure what the prefix of \xac\xed\x00\x05t\x00\x06 is? Could anyone explain. Thanks

答案1

得分: 1

我自己的愚蠢。关键是 org.bson.ObjectId 而不是 java.lang.String

使用 MONITOR 在 redis 上能帮我看到错误。

英文:

My own stupidity. The key was an org.bson.ObjectId not a java.lang.String

using the MONITOR on the redis was able to help me see the error

huangapple
  • 本文由 发表于 2023年5月11日 17:50:41
  • 转载请务必保留本文链接:https://go.coder-hub.com/76226316.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定