- Some caching systems don't provide read-through and write-through/write-behind operations.
- Applications take the responsibility of using the cache to maintain data.
- The cache does not interact with database directly.
- Check the requested record is held in the cache or not:
- If the requested record is held in the cache:
- Return the record directly.
- If the requested record is not in the cache:
- Read the record from the database and return it.
- Store the copy of the record in the cache.
- If the requested record is held in the cache:
- Write the record into the database.
- Invalidate the corresponding record in the cache.
- Improve performance on read operations generally.
- Cost more efforts on development (Applications need to handle both cache and database).
- Data in the cache can become stale if it is updated in the database.
- Each cache miss causes a noticeable delay (Data need to load from database to cache through application).
Topic | Consideration | Possible Solution Options |
---|
- The cache doesn't provide read-through and write-through/write-behind operations.
- The application performs more read operations than write operations.
- Web Article: Cache-Aside pattern | https://docs.microsoft.com/en-us/azure/architecture/patterns/cache-aside
- Web Article: [缓存更新的套路 | https://coolshell.cn/articles/17416.html)