title: How to use the client storage, redux store and SQL backend together in Angular?
body: <p>I'm trying to use the <a href="https://docs.microsoft.com/en-us/azure/architecture/patterns/cache-aside" rel="nofollow noreferrer">cache-aside</a> pattern in an <a href="https://angular.io/" rel="nofollow noreferrer">Angular</a> app. I have a <code>MS SQL DB</code> Backend from where I read <code>products</code> data. I use <a href="https://github.com/ngrx/store" rel="nofollow noreferrer">@ngrx store</a>, and that's where I keep the state of the <code>products</code> after I read from the <code>MS SQL DB</code> Backend.</p>
  
  <p>Into this mix, I added <a href="https://github.com/ngrx/db" rel="nofollow noreferrer">@ngrx db</a> to cache the <code>products</code> data. The purpose is to read from the <code>IndexedDB</code> after browser is closed and open again, so to avoid a trip to the server.</p>
  
  <p>In this <a href="https://docs.microsoft.com/en-us/azure/architecture/patterns/cache-aside" rel="nofollow noreferrer">cache-aside</a> pattern, I see a cache and the server. In my app, that is <code>IndexedDB</code> and the <code>MS SQL DB</code>. I don't know how to use the <code>@ngrx redux store</code> in this mix.</p>
  
  <ol>
  <li>When the application starts, should I read all the state from the cache (<code>IndexedDB</code>) to the redux store, and access the state from the redux store?</li>
  <li>Or should I replace the redux store and use only cache (<code>IndexedDB</code>)?</li>
  <li>Should I update the <code>@ngrx redux store</code> or the <code>IndexedDB</code> first if I have to update/write an entry?</li>
  <li>Is using both the <code>IndexedDB</code> and the <code>@ngrx store</code> inefficient because of the duplication of the data (one in memory and one on the disk)?</li>
  </ol>