[id='shared-cache-stores_{context}']
= Shared cache stores

{brandname} cache stores can be local to a given node or shared across all nodes in the cluster.
By default, cache stores are local (`shared="false"`).

* Local cache stores are unique to each node; for example, a file-based cache store that persists data to the host filesystem.
+
Local cache stores should use "purge on startup" to avoid loading stale entries from persistent storage.

* Shared cache stores allow multiple nodes to use the same persistent storage; for example, a JDBC cache store that allows multiple nodes to access the same database.
+
Shared cache stores ensure that only the primary owner write to persistent storage, instead of backup nodes performing write operations for every modification.

[IMPORTANT]
====
Purging deletes data, which is not typically the desired behavior for persistent storage.
====

.Local cache store
[source,xml,options="nowrap",subs=attributes+,role="primary"]
----
<persistence>
  <store shared="false"
         purge="true"/>
</persistence>
----

.Shared cache store
[source,xml,options="nowrap",subs=attributes+,role="secondary"]
----
<persistence>
  <store shared="true"
         purge="false"/>
</persistence>
----

[role="_additional-resources"]
.Additional resources
* link:{configdocroot}[{brandname} Configuration Schema]
