title: Redisson - RMapCache prepends 2 additional bytes to value
body: <p>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.</p>
  
  <p>The issue is that Redisson prepends 2 bytes to each value in HSET when RMapCache is used:
  <a href="https://i.stack.imgur.com/lgJvc.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/lgJvc.png" alt="enter image description here"></a></p>
  
  <p>After spending some time digging in Redisson source code, I've found Lua script used in insertion procedure, which has following lines:</p>
  
  <pre><code>  local val = struct.pack('dLc0', tonumber(ARGV[4]), string.len(ARGV[6]), ARGV[6]);
    redis.call('hset', KEYS[1], ARGV[5], val);
  </code></pre>
  
  <p>ARGV[6] is value itself, so other two bytes are:</p>
  
  <ul>
  <li>max idle time in milliseconds (can be passed to put method)</li>
  <li>length of value</li>
  </ul>
  
  <p>This effectively makes Redis HSET unusable from other languages or Java clients other then Redisson.</p>
  
  <p>Has somebody encountered same problem and know how to deal with it?</p>