auntyellow
auntyellow

Reputation: 2573

how redisson serialize long

I use redisson to store Long values:

        RSet<Long> set = client.getSet("myset");
        set.add(Long.valueOf(n));

But I get an unreadable value:

> SMEMBERS myset
1) "\t\x84\xe2\x02"

How can I retrieve this value without redisson?

Upvotes: 3

Views: 1443

Answers (1)

Aayushya Vajpayee
Aayushya Vajpayee

Reputation: 46

The default codec for Redisson from version 3.13.0 is MarshallingCodec and before that it was FSTCodec. Both of these serialize to binary formats which are not human readable.

To serialize long and integer values Redisson offers LongCodec. The corresponding code will look like this:

RSet<Long> set = client.getSet("myset",LongCodec.INSTANCE);
set.add(Long.valueOf(n));

Upvotes: 3

Related Questions