0

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 ?

Alex Harris
  • 6,172
  • 2
  • 32
  • 57
Bala.vrad
  • 53
  • 9

1 Answers1

1

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.

Redisson_RuiGu
  • 1,012
  • 10
  • 13