Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ISPN-16679 Instant cache snapshot switching blog post #349

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions _posts/2024-05-30-cache-alias.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
layout: blog
title: Instant Switching of Cache Snapshots
permalink: /blog/:year/:month/:day/cache-snapshots
date: '2024-05-30T00:00:00.000-00:00'
author: ttarrant
tags: [ "alias", "snapshots" ]
---

= Instant Switching of Cache Snapshots

Populating a cache with data is usually done in two ways:

* on-demand: whenever an application needs an item of data, it checks the cache first and, if a miss occurs, retrieves the data from a third-party system (a database or an external service) and inserts it in the cache for further use.
* batched: at a specified time, a dedicated task retrieves all of the data that should be cached and refreshes the content of the cache, often using bulk operations to optimize write performance

The *on-demand* scenario relies on expiration and/or eviction policies to control how much data is kept in the cache and for how long. The *batch* scenario keeps the whole data set in the cache until the next refresh.

Batch refreshing can use two approaches: either the cache is cleared before the new snapshot is written to it, or the entries are overwritten. The latter is only possible if the keys do not change between snapshots.

In both approaches, however, it is possible for client applications to see an incomplete or inconsistent snapshot.

Infinispan 15 introduced the concept of cache aliases. A cache alias is essentially another name by which clients can access the contents of a cache.