18.2. Cache Store Configuration Details (Library Mode)
The following lists contain details about the configuration elements and parameters for cache store elements in JBoss Data Grid's Library mode:
The namedCache Element
- Add the name value to the
name
parameter to set the name of the cache store.
The persistence Element
- The
passivation
parameter affects the way in which Red Hat JBoss Data Grid interacts with stores. When an object is evicted from in-memory cache, passivation writes it to a secondary data store, such as a system or a database. Valid values for this parameter aretrue
andfalse
butpassivation
is set tofalse
by default.
The singleFile Element
- The
shared
parameter indicates that the cache store is shared by different cache instances. For example, where all instances in a cluster use the same JDBC settings to talk to the same remote, shared database.shared
isfalse
by default. When set totrue
, it prevents duplicate data being written to the cache store by different cache instances. For the LevelDB cache stores, this parameter must be excluded from the configuration, or set tofalse
because sharing this cache store is not supported. - The
preload
parameter is set tofalse
by default. When set totrue
the data stored in the cache store is preloaded into the memory when the cache starts. This allows data in the cache store to be available immediately after startup and avoids cache operations delays as a result of loading data lazily. Preloaded data is only stored locally on the node, and there is no replication or distribution of the preloaded data. Red Hat JBoss Data Grid will only preload up to the maximum configured number of entries in eviction. - The
fetchPersistentState
parameter determines whether or not to fetch the persistent state of a cache and apply it to the local cache store when joining the cluster. If the cache store is shared the fetch persistent state is ignored, as caches access the same cache store. A configuration exception will be thrown when starting the cache service if more than one cache store has this property set totrue
. ThefetchPersistentState
property isfalse
by default. - The
ignoreModifications
parameter determines whether modification methods are applied to the specific cache store. This allows write operations to be applied to the local file cache store, but not the shared cache store. In some cases, transient application data should only reside in a file-based cache store on the same server as the in-memory cache. For example, this would apply with a further JDBC based cache store used by all servers in the network.ignoreModifications
isfalse
by default. - The
maxEntries
parameter provides maximum number of entries allowed. The default value is -1 for unlimited entries. - The
maxKeysInMemory
parameter is used to speed up data lookup. The single file store keeps an index of keys and their positions in the file, restricting the size of the index using themaxKeysInMemory
parameter. The default value for this parameter is -1. - The
purgeOnStartup
parameter controls whether cache store is purged when it starts up. - The
location
configuration element sets a location on disk where the store can write.
The async Element
The async
element contains parameters that configure various aspects of the cache store.
- The
enabled
parameter determines whether the file store is asynchronous. - The
threadPoolSize
parameter specifies the number of threads that concurrently apply modifications to the store. The default value for this parameter is1
. - The
flushLockTimeout
parameter specifies the time to acquire the lock which guards the state to be flushed to the cache store periodically. The default value for this parameter is1
. - The
modificationQueueSize
parameter specifies the size of the modification queue for the asynchronous store. If updates are made at a rate that is faster than the underlying cache store can process this queue, then the asynchronous store behaves like a synchronous store for that period, blocking until the queue can accept more elements. The default value for this parameter is1024
elements. - The
shutdownTimeout
parameter specifies maximum amount of time that can be taken to stop the cache store. Default value for this parameter is25
seconds.
The singleton Element
The singleton
element enables modifications to be stored by only one node in the cluster. This node is called the coordinator. The coordinator pushes the caches in-memory states to disk. The shared
element cannot be defined with singleton
enabled at the same time.
- The
enabled
attribute determines whether this feature is enabled. Valid values for this parameter aretrue
andfalse
. Theenabled
attribute is set tofalse
by default. - The
pushStateWhenCoordinator
parameter is set totrue
by default. Iftrue
, this property causes a node that has become the coordinator to transfer in-memory state to the underlying cache store. This parameter is useful where the coordinator has crashed and a new coordinator is elected. - When
pushStateWhenCoordinator
is set totrue
, thepushStateTimeout
parameter sets the maximum number of milliseconds that the process pushing the in-memory state to the underlying cache loader can take. The default time for this parameter is 10 seconds.
The remoteStore Element
- The
remoteCacheName
attribute specifies the name of the remote cache to which it intends to connect in the remote Infinispan cluster. The default cache will be used if the remote cache name is unspecified. - The
fetchPersistentState
attribute, when set totrue
, ensures that the persistent state is fetched when the remote cache joins the cluster. If multiple cache stores are chained, only one cache store can have this property set totrue
. The default for this value isfalse
. - The
shared
attribute is set totrue
when multiple cache instances share a cache store, which prevents multiple cache instances writing the same modification individually. The default for this attribute isfalse
. - The
preload
attribute ensures that the cache store data is pre-loaded into memory and is immediately accessible after starting up. The disadvantage of setting this totrue
is that the start up time increases. The default value for this attribute isfalse
. - The
ignoreModifications
attribute prevents cache modification operations such as put, remove, clear, store, etc. from affecting the cache store. As a result, the cache store can become out of sync with the cache. The default value for this attribute isfalse
. - The
purgeOnStartup
attribute ensures that the cache store is purged during the start up process. The default value for this attribute isfalse
. - The
tcpNoDelay
attribute triggers theTCP
NODELAY
stack. The default value for this attribute istrue
. - The
pingOnStartup
attribute sends a ping request to a back end server to fetch the cluster topology. The default value for this attribute istrue
. - The
keySizeEstimate
attribute provides an estimation of the key size. The default value for this attribute is64
. - The
valueSizeEstimate
attribute specifies the size of the byte buffers when serializing and deserializing values. The default value for this attribute is512
. - The
forceReturnValues
attribute sets whetherFORCE_RETURN_VALUE
is enabled for all calls. The default value for this attribute isfalse
.
The servers and server Elements
Create a servers
element within the remoteStore
element to set up the server information for multiple servers. Add a server
element within the general servers
element to add the information for a single server.
- The
host
attribute configures the host address. - The
port
attribute configures the port used by the Remote Cache Store.
The connectionPool Element
- The
maxActive
attribute indicates the maximum number of active connections for each server at a time. The default value for this attribute is-1
which indicates an infinite number of active connections. - The
maxIdle
attribute indicates the maximum number of idle connections for each server at a time. The default value for this attribute is-1
which indicates an infinite number of idle connections. - The
maxTotal
attribute indicates the maximum number of persistent connections within the combined set of servers. The default setting for this attribute is-1
which indicates an infinite number of connections. - The
connectionUrl
parameter specifies the JDBC driver-specific connection URL. - The
username
parameter contains the username used to connect via theconnectionUrl
. - The
driverClass
parameter specifies the class name of the driver used to connect to the database.
The leveldbStore Element
- The
location
parameter specifies the location to store the primary cache store. The directory is automatically created if it does not exist. - The
expiredLocation
parameter specifies the location for expired data using. The directory stores expired data before it is purged. The directory is automatically created if it does not exist. - The
shared
parameter specifies whether the cache store is shared. The only supported value for this parameter in the LevelDB cache store isfalse
. - The
preload
parameter specifies whether the cache store will be pre-loaded. Valid values aretrue
andfalse
.
The jpaStore Element
- The
persistenceUnitName
attribute specifies the name of the JPA cache store. - The
entityClassName
attribute specifies the fully qualified class name of the JPA entity used to store the cache entry value. - The
batchSize
(optional) attribute specifies the batch size for cache store streaming. The default value for this attribute is100
. - The
storeMetadata
(optional) attribute specifies whether the cache store keeps the metadata (for example expiration and versioning information) with the entries. The default value for this attribute istrue
.
The binaryKeyedJdbcStore, stringKeyedJdbcStore, and mixedKeyedJdbcStore Elements
- The
fetchPersistentState
parameter determines whether the persistent state is fetched when joining a cluster. Set this totrue
if using a replication and invalidation in a clustered environment. Additionally, if multiple cache stores are chained, only one cache store can have this property enabled. If a shared cache store is used, the cache does not allow a persistent state transfer despite this property being set totrue
. ThefetchPersistentState
parameter isfalse
by default. - The
ignoreModifications
parameter determines whether operations that modify the cache (e.g. put, remove, clear, store, etc.) do not affect the cache store. As a result, the cache store can become out of sync with the cache. - The
purgeOnStartup
parameter specifies whether the cache store is purged when initially started. - The
key2StringMapper
parameter specifies the class name of the Key2StringMapper used to map keys to strings for the database tables.
The binaryKeyedTable and stringKeyedTable Elements
- The
dropOnExit
parameter specifies whether the database tables are dropped upon shutdown. - The
createOnStart
parameter specifies whether the database tables are created by the store on startup. - The
prefix
parameter defines the string prepended to name of the target cache when composing the name of the cache bucket table.
The idColumn, dataColumn, and timestampColumn Elements
- The
name
parameter specifies the name of the column used. - The
type
parameter specifies the type of the column used.
The store Element
- The
class
parameter specifies the class name of the cache store implementation. - The
preload
parameter specifies whether to load entries into the cache during start up. Valid values for this parameter aretrue
andfalse
. - The
shared
parameter specifies whether the cache store is shared. This is used when multiple cache instances share a cache store. Valid values for this parameter aretrue
andfalse
.
The property Element
- The
name
parameter specifies the name of the property. - The
value
parameter specifies the value of the property.