Cache invalidation definition
Cache invalidation is a caching process that includes a computer system declaring cached content as invalid or stale, meaning that the content will be removed or replaced, and it will no longer be displayed upon request. The purpose of cache invalidation is to ensure that when the subsequent user requests the said content, they are served with the newest version. In addition, cache invalidation can be used to promote and show new content to end users. Cache invalidation can also help users optimize their websites, use fewer server resources, and decrease the loading times of their web pages. Cache invalidation can be performed explicitly or as part of a cache coherence protocol.
Cache invalidation methods
- Purging: This method removes the invalidated content from the caching proxy instantly. It also removes all versions of the cached content.
- Refreshing: The requested content is fetched from the application, even if the content is available in the cache. Additionally, the previously stored content in the cache is replaced with the latest version of the application. However, refreshing affects only one variant of the cached content.
- Banning: This method includes adding a reference of the cached content to a blocklist. Then, user requests are checked against the blocklist, and if they match, the new content from the application is served to the user and added to the cache.