Announcement Announcement Module
Collapse
No announcement yet.
basic redis functionality Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • basic redis functionality

    trying to simply get redis working with my spring project. I am connected to a redis to go instance.

    When trying a simple:
    redisTemplate.opsForValue().set("key", "val");

    it is not updating the key and im getting this debug:
    14:52:35 DEBUG [RedisConnectionUtils] Opening RedisConnection
    14:52:35 DEBUG [RedisConnectionUtils] Closing Redis Connection

    seems like the simplest use case:

    <bean id="jedisConnectionFactory" class="org.springframework.data.redis.connection.j edis.JedisConnectionFactory"
    p:host-name="angler.redistogo.com" port="9512"
    password="************************"/>
    <bean id="redisTemplate" class="org.springframework.data.redis.core.RedisTe mplate"
    p:connection-factory-ref="jedisConnectionFactory"/>

  • #2
    And what makes you think the key is not written? Have you checked the redis instance (opened on port 9512)?
    Note that there's a sample (Twitter clone on top of Redis) that should help you get started with the setup, if you face any problems - just refer to the reference documentation.

    Comment


    • #3
      thank

      Costin,

      Thanks for the reply. Well I am connected to my redis instance via redis-cli and was not getting anything when issuing get commands. I have since discovered the MONITOR command and noticed that when I thought I was setting a string 'key', the following was actually happening:
      \xac\xed\x00\x05t\x00\x06key" "\xac\xed\x00\x05t\x00\x03wtf"

      I know that I have seen this somewhere in the doc or a tutorial...

      Thanks,
      Bobby

      Comment


      • #4
        It's the RedisTemplate with the default JDK serializer - switch to StringRedisTemplate or set a different serializer.

        Comment

        Working...
        X