[id='xsite_state_transfer-{context}']
= State Transfer
State transfer is an administrative operation that synchronizes data between
sites.

For example, **LON** goes offline and **NYC** starts handling client requests.
When you bring **LON** back online, the {brandname} cluster in **LON** does not
have the same data as the cluster in **NYC**.

To ensure the data is consistent between **LON** and **NYC**, you can push
state from **NYC** to **LON**.

* State transfer is bidirectional. For example, you can push state from **NYC**
to **LON** or from **LON** to **NYC**.
* Pushing state to offline sites brings them back online.
* State transfer overwrites only data that exists on both sites, the originating site and the receiving site. {brandname} does not delete data.
+
For example, "k2" exists on **LON** and **NYC**. "k2" is removed from **NYC**
while **LON** is offline. When you bring **LON** back online, "k2" still exists
at that location. If you push state from **NYC** to **LON**, the transfer does
not affect "k2" on **LON**.
+
[TIP]
====
To ensure contents of the cache are identical after state transfer, remove all
data from the cache on the receiving site before pushing state. Use the
`clear()` method.
====
+
* State transfer does not overwrite updates to data that occur after you
initiate the push.
+
For example, "k1,v1" exists on **LON** and **NYC**. **LON** goes offline so you
push state transfer to **LON** from **NYC**, which brings **LON** back online.
Before state transfer completes, a client puts "k1,v2" on **LON**.
+
In this case the state transfer from **NYC** does not overwrite "k1,v2" because
that modification happened after you initiated the push.

.Reference

* link:{javadocroot}/org/infinispan/Cache.html#clear()[org.infinispan.Cache.clear()]
* link:{cli_docs}#deleting_cache_entries[Clearing Caches with the CLI]
+
[TIP]
====
Run `help clearcache` from the CLI for command details and examples.
====

* link:{rest_docs}#rest_v2_clear_cache[Clearing Caches with the REST API]
