title: Cached data Synchronization to Database
body: <p>What are the best ways to keep data synchronized between in memory cache and the database when used in a web application? Specifically, I store large amounts of database data in an in-memory cache using EHcache on my web application. For many interactions, I would like to simply modify the value in cache, and only synchronize it with the database during low-traffic times. What is a good way to do this as well to minimize the loss of data should an unexpected shutdown occur? </p>