Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 327
auntyellow Avatar asked May 12 '26 16:05

auntyellow


1 Answers

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));
like image 136
Aayushya Vajpayee Avatar answered May 14 '26 06:05

Aayushya Vajpayee



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!