title: How could I get api cache with external query (not with ActiveRecord)
body: <p>The query response is not from ActiveRecord </p>
  
  <p>and the response is in JSON format.</p>
  
  <p>How could I cache the return result</p>
  
  <pre><code>  def get_drug_usage_history_by_symptoms
        pipeline_work = [
        {"$unwind" =&gt; "$records"},
        {'$match' =&gt; {'records.items' =&gt; {'$in' =&gt; items} }},
        {'$limit' =&gt; 8 } # FOR DEVELOPMENT USE
      ]
        cur = db[collection].find.aggregate(pipeline_work).allow_disk_use(true)
      respond_to do |format|
        format.json { render json: cur.to_a }
      end
    end
  </code></pre>