[id='configuring-single-file-stores_{context}']
= Configuring single file cache stores

If required, you can configure {brandname} to create single file stores.

[IMPORTANT]
====
Single file stores are deprecated.
You should use soft-index file stores for better performance and data consistency in comparison with single file stores.
====

.Prerequisites

* Enable global state and configure a global persistent location if you are configuring embedded caches.

.Procedure

. Add the `persistence` element to your cache configuration.
. Optionally specify `true` as the value for the `passivation` attribute to write to the file-based cache store only when data is evicted from memory.
. Include the `single-file-store` element.
. Specify `false` as the value for the `shared` attribute.
. Configure any other attributes as appropriate.
. Include the `write-behind` element to configure the cache store as write behind instead of as write through.

[discrete]
== Single file cache store configuration

.XML
[source,xml,options="nowrap",subs=attributes+,role="primary"]
----
include::xml/persistence_single_file_store.xml[]
----

.JSON
[source,json,options="nowrap",subs=attributes+,role="secondary"]
----
include::json/persistence_single_file_store.json[]
----

.YAML
[source,yaml,options="nowrap",subs=attributes+,role="secondary"]
----
include::yaml/persistence_single_file_store.yaml[]
----

.ConfigurationBuilder
[source,java,options="nowrap",subs=attributes+,role="secondary"]
----
include::code_examples/PersistenceSingleFileStore.java[]
----
