title: how to update cache only when data is changed?
body: <p><strong>Current Scenario :-</strong> </p>
  
  <p>I have a C# code which gets data from MySql server (data from Strored procedures) and stores the
  data in JSON format in Redis. This updates the cache (redis) for about every half an hour, irrespective of whether the data in mysql remains same / different (since i don't have clue about data change). </p>
  
  <p><strong>Requirement :-</strong></p>
  
  <p>Need to build the same system, instead of updating cache in predefined intervals even when the data is same i need to modify the cache only when the data is changed.</p>
  
  <p><strong>Couchbase :-</strong></p>
  
  <p>I heard of couchbase views. I am very new to that. I can change my data from mysql to JSON Documents in couchbase. My Question is, will this couchbase views is suitable for that ?</p>
  
  <p>My Idea is </p>
  
  <pre><code>1. Data from MySql       =&gt; JSON in couchbase bucket
  2. StoredProcedure logic =&gt; couchbase views
  </code></pre>
  
  <p>When the data from couchbase bucket changes, then this view should run again otherwise it should fetch from cache without running the view again. Is this possible in views ?</p>
  
  <p>If not please tell any other solution for this.</p>
  
  <p>Thanks in advance.</p>