Answer to question 1:
Redisson (Redis Java client) can work with POJO objects. And you don't need to serialize/deserialize object by yourself each time and work with connections (acquire/release). It's all done by the Redisson.
Here is an example:
RBucket<AnyObject> bucket = redisson.getBucket("anyObject");
// set an object
bucket.set(new AnyObject());
// get an object
AnyObject myObject = bucket.get();
or you can use LiveObjectService which stores POJO fields as keys in Redis hash object.
@REntity
public class MyObject {
@RId
private String id;
@RIndex
private String value;
private MyObject parent;
public MyObject(String id) {
this.id = id;
}
public MyObject() {
}
// getters and setters
}
Redisson supports many popular codecs like Jackson JSON
, Avro
, Smile
, CBOR
, MsgPack
, Kryo
, FST
, LZ4
, Snappy
and JDK Serialization
.