Chapter 2. Architecture

Schematic TreeCache architecture

Figure 2.1. Schematic TreeCache architecture

The architecture is shown above. The example shows 2 Java VMs, each has created an instance of TreeCache. These VMs can be located on the same machine, or on 2 different machines. The setup of the underlying group communication subsystem is done using JGroups.

Any modification (see API below) in one cache will be replicated to the other cache[1] and vice versa. Depending on the transactional settings, this replication will occur either after each modification or at the end of a transaction (at commit time). When a new cache is created, it can optionally acquire the contents from one of the existing caches on startup.

[1] Note that you can have more than 2 caches in a cluster.