Alexandr Alexandr - 11 months ago 119
Java Question

How to use Redisson to upload byte array in Redis Cluster?

I haven't found an explanation about how to upload pure array of bytes. Redisson has a RBitSet but it manages an array of bits not bytes. How to store a byte array by using Redisson?

Here is my configuration:

Config config = new Config();

LoadBalancer loadBalancer = new RoundRobinLoadBalancer();

.setScanInterval(5000) // cluster state scan interval in milliseconds
.addNodeAddress("", "")

RedissonClient redisson = Redisson.create(config);

Answer Source

I was helped on github. Here is how to write a byte array:

RBucket<byte[]> bucket = redisson.getBucket("myBucket", ByteArrayCodec.INSTANCE);
byte[] myarray = ...