redisredisson

Redisson storing value in hash form


When I am trying to use Redisson library it always store data in hash form. Is there anyway I can avoid it if I like

        Config config = new Config();
        config.useSingleServer()
                .setAddress("redis://127.0.0.1:6379");
        RedissonClient redisson = Redisson.create(config);
        System.out.println("Config created"+redisson);
        RBucket<String> r=redisson.getBucket("test");
        r.set("value", 1000000, TimeUnit.SECONDS);

Here is how I see the data in Redis

127.0.0.1:6379> Get test
"\x03valu\xe5"

How can I view the data properly from the redis cli? Or how can I avoid storing the value in hash form completely


Solution

  • By Default Redisson will use Kryo5Codec as codec for all the objects.

    If you want to use some other codec, specify the codec while getting redisson objects like below.

    getRedissonClient().getBucket("test", StringCodec.INSTANCE);
    

    For other codecs, check out this link