I'm using Redisson's RMapCache structure because it supports entries eviction by time to live and by setting maximum size of map. While everything works without problems in Java, I've found out that NodeJS app that uses same Redis instance couldn't fetch values from the same underlying HSET structure.
The issue is that Redisson prepends 2 bytes to each value in HSET when RMapCache is used:
After spending some time digging in Redisson source code, I've found Lua script used in insertion procedure, which has following lines:
local val = struct.pack('dLc0', tonumber(ARGV[4]), string.len(ARGV[6]), ARGV[6]);
redis.call('hset', KEYS[1], ARGV[5], val);
ARGV[6] is value itself, so other two bytes are:
- max idle time in milliseconds (can be passed to put method)
- length of value
This effectively makes Redis HSET unusable from other languages or Java clients other then Redisson.
Has somebody encountered same problem and know how to deal with it?