我成功地将值插入到我的redis缓存中,当试图获取存储的值时,我得到的值类似
127.0.0.1:6379> HGETALL UPGRADE_ME
1) "xfcr-447340129694"
2) "x00x00x00x00x00x00x00x00Sx00x00x00x00x00x00x00x00x010com.customer.upgrade.Keyx00xfdx00x00x00x00x00xd0xbe@xffx00x10x00xffxfcx04timexffxffxfcx06reasonx00"
值是否存储为binary
?此外,我如何将其存储为json
。?
我的java代码看起来像
RMapCache<String, Key> keys= redissonClient.getMapCache(UPGRADE_ME);
keys.put(key1, obj, cacheProperties.getProps(),
TimeUnit.SECONDS);
有API可以传递编解码器,我们可以传递org.redisson.codec.JsonJacksonCodec()
以将对象存储为json
RMapCache<String, Key> keys= redissonClient.getMapCache(UPGRADE_ME,new org.redisson.codec.JsonJacksonCodec());
keys.put(key1, obj, cacheProperties.getProps(),
TimeUnit.SECONDS);