title: how to optimize Graphql with Redis
body: <p>currently I have graphql with mongodb, and now I want add redis layer to optimize server response time.</p>
  
  <p>assume I have schema like this:</p>
  
  <pre><code>type Query{
    book(id: ID):Book
  }
  type Book{
    # simple fields direct come from mongodb collection Book
    A
    B
    C
  
    # fields with values generated from simple fields
    X
    Y
    Z
  
    # fields with aggregated data from other db collections e.g avg/min/max
    L
    M
    N
  
  }
  </code></pre>
  
  <p>Here is the question: what kind of data should I store in Redis?</p>
  
  <p>1) stringified raw doc from db, keyed by ID</p>
  
  <p>2) put each calculated field into a hash value for redis, each field use HGET from redis</p>
  
  <p>here are my concerns about above options:</p>
  
  <p>1) fields ABC/XYZ should be fine but LMN will result in extra db accesses</p>
  
  <p>2) when query all fields for Book, there will one HGET for each field and most of them are just simple values, maybe wasting time on initiation too many requests? </p>