[id='remote_cache_store']
= Remote Cache Stores
Remote cache stores, `RemoteStore`, use the Hot Rod protocol to store data on
{brandname} clusters.

The following is an example `RemoteStore` configuration that stores data in a
cache named "mycache" on two {brandname} Server instances, named "one" and
"two":

[NOTE]
====
If you configure remote cache stores as shared you cannot preload data. In
other words if `shared="true"` in your configuration then you must set 
`preload="false"`.
====

.Declarative configuration

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

.Programmatic configuration

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

.Segmentation

`RemoteStore` supports segmentation and can publish keys and entries by
segment, which makes bulk operations more efficient. However, segmentation is
available only with {brandname} Hot Rod protocol version 2.3 or later.

[WARNING]
====
When you enable segmentation for `RemoteStore`, it uses the number of segments
that you define in your {brandname} server configuration.

If the source cache is segmented and uses a different number of segments than
`RemoteStore`, then incorrect values are returned for bulk operations. In this
case, you should disable segmentation for `RemoteStore`.
====

.Reference

* link:{configdocroot}infinispan-cachestore-remote-config-{schemaversion}.html[Remote cache store configuration schema]
* link:{javadocroot}/org/infinispan/persistence/remote/RemoteStore.html[RemoteStore]
* link:{javadocroot}/org/infinispan/persistence/remote/configuration/RemoteStoreConfigurationBuilder.html[RemoteStoreConfigurationBuilder]
