I set value using ZADD and get value by ZRANGBYSCORE
redis 127.0.0.1:6379> ZADD mytest 1 "one" 2 "two" 3 "three"
(integer) 3
redis 127.0.0.1:6379> ZRANGEBYSCORE mytest 1 3
1) "one"
2) "two"
3) "three"
then, i set value using SPRING-DATA-REDIS API
redisTemplate.opsForZSet().add("mytest", "four", 4.0);
but, i get value using SPRING-DATA-REDIS API and return value which is not i expect(i expect is [one, two, three, four])
Set<Object> result = redisTemplate.opsForZSet().rangeByScore("mytest", 1.0, 4.0);
System.out.println(result);
[four]
and check by redis-cli
redis 127.0.0.1:6379> ZRANGEBYSCORE mytest 1 4
1) "one"
2) "two"
3) "three"
Why data does not seem to been sync?
Any help appreciated much!
<bean id="redisTemplate" class="org.springframework.data.redis.core.RedisTemplate"
p:connection-factory-ref="jedisConnectionFactory">
<property name="valueSerializer">
<bean class="org.springframework.data.redis.serializer.StringRedisSerializer" />
</property>
<property name="keySerializer">
<bean class="org.springframework.data.redis.serializer.StringRedisSerializer" />
</property>
</bean>
I find a way,change redisTemplate setting like this will ok~
:)