title: Best way to store big complex java class objects in Redis?
body: <p>What is the best way to store a nested and complex java object in Redis. The way we are doing is as follows.</p>
  
  <p>We are using <a href="https://github.com/redisson/redisson" rel="nofollow noreferrer">Redisson</a> java client library for Redis interactions. Please see the code below :</p>
  
  <pre><code>   try{
          Config conf = new Config();
          conf.useSingleServer().setTimeout(3600000);
          conf.useSingleServer().setRetryInterval(3600000);
          conf.useSingleServer().setAddress("redis://127.0.0.1:6379");
          RedissonClient redisson = Redisson.create(conf);
          RMap&lt;String,Object&gt; map = redisson.getMap("myCache");
          MyClass myObject; // This is the big complex object.
          map.put("key", myObject);
          redisson.shutdown();
      }catch (Exception ex) {
          ex.printStackTrace();
      }
  </code></pre>
  
  <p>Similarly, instead of put, we are using get to fill our myObject from redis.</p>
  
  <p>We have increased the timeouts because of big size data being stored in redis, We were getting following exception :</p>
  
  <p><strong>Command execution timeout for command: (EVAL) with params...</strong></p>
  
  <p>Please answer the following questions as well :</p>
  
  <ol>
  <li>Is this the best way to put huge complex java objects in Redis? (The data can be around 1GB)</li>
  <li>Our team is new to Redis, We have read the good performance given by Redis, Should we use it to store complex data or it is good only in case of small single String as the value? (If So, what is Advised for our use case)</li>
  </ol>
  
  <p>Thanks.</p>