Bala.vrad
Bala.vrad

Reputation: 53

Java Redisson Integration

I have a scenario, where the datastructure I need to go with is a Map<String,Map<String,List<String>>.

And I want to use Redis to store this data as in-memory cache.

One thing I am interested in is that, making the "key" of the child map, (which in this case is Map<String,List<String>>) to be expiring after say 5 mins.

I tried something like this in Redis (Redisson implementation),

RMap<String,Map<String,List<String>> parentMap = redisson.getMap("parentMap");

RMapCache<String,List<String>> childCache = redisson.getMapCache("childMapCache");

childCache.put("test",new ArrayList<String>(),5,TimeUnit.Minutes);

//Placing the child cache into parent map
parentMap.put("child",childCache);

But when I do this, I get the below error message (taken the root cause out)

"unnotified cause: io.netty.handler.codec.EncoderException:
java.io.NotSerializableException: org.redisson.RedissonReference"

Is there a work-around to get some datastructure like this into Redis ?

Upvotes: 0

Views: 1196

Answers (1)

Redisson_RuiGu
Redisson_RuiGu

Reputation: 1032

This error happens when Java serialization or similar codec has been used, and it has now been fixed in 2.9.3 and 3.4.3.

Upvotes: 1

Related Questions