我有一个场景,我需要使用的数据结构是Map<String,Map<String,List<String>>
.
我想使用 Redis 将这些数据存储为内存缓存。
我感兴趣的一件事是,使子地图的“钥匙”(在这种情况下是Map<String,List<String>>
)在说 5 分钟后到期。
我在 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);
但是当我这样做时,我收到以下错误消息(排除了根本原因)
"unnotified cause: io.netty.handler.codec.EncoderException:
java.io.NotSerializableException: org.redisson.RedissonReference"
是否有一种解决方法可以将这样的数据结构放入 Redis 中?