[id='sifs_cache_store']
= Soft-Index File Stores
Soft-Index File cache stores, `SoftIndexFileStore`, provide local file-based
storage.

`SoftIndexFileStore` is a Java implementation that uses a variant of **B+
Tree** that is cached in-memory using Java soft references. The **B+ Tree**,
called `Index` is offloaded on the file system to a single file that is purged
and rebuilt each time the cache store restarts.

`SoftIndexFileStore` stores data in a set of files rather than a single file.
When usage of any file drops below 50%, the entries in the file are overwritten
to another file and the file is then deleted.

`SoftIndexFileStore` persists data in a set of files that are written in an
append-only method. For this reason, if you use `SoftIndexFileStore` on
conventional magnetic disk, it does not need to seek when writing a burst of
entries.

Most structures in `SoftIndexFileStore` are bounded, so out-of-memory
exceptions do not pose a risk. You can also configure limits for concurrently
open files.

By default the size of a node in the `Index` is limited to 4096 bytes. This
size also limits the key length; more precisely the length of serialized keys.
For this reason, you cannot use keys longer than the size of the node, 15
bytes. Additionally, key length is stored as "short", which limits key length
to 32767 bytes. `SoftIndexFileStore` throws an exception if keys are longer
after serialization occurs.

`SoftIndexFileStore` cannot detect expired entries, which can lead to excessive
usage of space on the file system .

[NOTE]
====
`AdvancedStore.purgeExpired()` is not implemented in `SoftIndexFileStore`.
====

.Declarative configuration

[source,xml,options="nowrap",subs=attributes+]
----
include::config_examples/persistence_soft_index_file_store.xml[]
----

.Programmatic configuration

[source,java]
----
include::code_examples/ConfigSoftIndexFileStore.java[]
----

.Segmentation

Soft-Index File cache stores support segmentation and create a separate
instance per segment, which results in multiple directories in the path you
configure. Each directory is a number that represents the segment to which the
data maps.

.Reference

* link:{configdocroot}infinispan-persistence-soft-index-config-{schemaversion}.html[Soft-Index File cache store configuration schema]
* link:{javadocroot}/org/infinispan/persistence/sifs/SoftIndexFileStore.html[SoftIndexFileStore]
* link:{javadocroot}/org/infinispan/persistence/sifs/configuration/SoftIndexFileStoreConfiguration.html[SoftIndexFileStoreConfiguration]
