title: Drawbacks of using redis cache for primary store and then syncing to a DB later?
body: <p>I'm writing an application and experimenting with serverless architecture and one of my thoughts is that the functions should execute reasonably quickly, which also acts as a money saving benefit from this an idea I had was regarding persistence of data to keep function execution times short.</p>
  <p>The function itself is simple, it takes 'cards' with text on and persists them. The application in particular will likely have these cards being created frequently, or being edited very frequently and in large quantities.</p>
  <p>Given this assumption, I figured rather than the function writing directly to a DB, it seems like it would make more sense to have the function write to a cache. Then later on, some kind of sync application could exist that takes data in the cache and persists it to the database.
  The synchronisation tool could be something that happens on a few machines that spin up and are dedicated to performing this, so can be done at a fixed rate rather than perhaps using some costly functions.</p>
  <p>This seems like a better option, but I'm wondering what the drawbacks of doing this are versus using a DB. Some of my thoughts so far are:</p>
  <ol>
  <li>consistency issues will be tricky since the sync would have to happen frequently enough where items in the cache don't expire before they can be saved and a user session ends.</li>
  <li>bundling into a sync means that operations can be performed in bulk rather than many single transactions, which sounds like a good thing</li>
  <li>it seems easier to setup caching in general by having it as the main driver of the data source as opposed to storing data in the cache and figuring out when to cache, etc.</li>
  </ol>
  <p>I'd also love to know what kind of things I can google to learn more about these concepts since at the moment these are ideas and I don't know the terminology to describe them and learn more about them. I'm sure this problem has been tackled many times before!</p>