我正在开发一个 Spring-MVC 应用程序,我在 Redis 中插入了一个 Person 对象。现在插入对象时,我还需要为检索到的 Person 提供 hashCode 值。有什么办法,我可以在不传递 hashCode 的情况下检索 Person 对象,只是关键部分。请告诉我。这是插入代码:
插入代码:
Person person = // person retrieved from DB.
this.userAppRegistration.getRedisTemplate().opsForHash().put(String.valueOf(person.getId()),person.hashCode(),person);
检索代码:
this.userAppRegistration.getRedisTemplate().opsForHash().get("Key_Available",)
此时我无权访问我插入的人的哈希码。我怎样才能只使用键检索 Person 对象。非常感谢。:-)