Ce contenu n'est pas disponible dans la langue sélectionnée.
18.2. Cache Store Configuration Details (Library Mode)
- Add the name value to the
nameparameter to set the name of the cache store.
- The
passivationparameter 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 aretrueandfalsebutpassivationis set tofalseby default.
- The
sharedparameter 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.sharedisfalseby 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 tofalsebecause sharing this cache store is not supported. - The
preloadparameter is set tofalseby default. When set totruethe 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
fetchPersistentStateparameter 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. ThefetchPersistentStateproperty isfalseby default. - The
ignoreModificationsparameter 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.ignoreModificationsisfalseby default. - The
maxEntriesparameter provides maximum number of entries allowed. The default value is -1 for unlimited entries. - The
maxKeysInMemoryparameter 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 themaxKeysInMemoryparameter. The default value for this parameter is -1. - The
purgeOnStartupparameter controls whether cache store is purged when it starts up. - The
locationconfiguration element sets a location on disk where the store can write.
The async element contains parameters that configure various aspects of the cache store.
- The
enabledparameter determines whether the file store is asynchronous. - The
threadPoolSizeparameter specifies the number of threads that concurrently apply modifications to the store. The default value for this parameter is1. - The
flushLockTimeoutparameter 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
modificationQueueSizeparameter 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 is1024elements. - The
shutdownTimeoutparameter specifies maximum amount of time that can be taken to stop the cache store. Default value for this parameter is25seconds.
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
enabledattribute determines whether this feature is enabled. Valid values for this parameter aretrueandfalse. Theenabledattribute is set tofalseby default. - The
pushStateWhenCoordinatorparameter is set totrueby 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
pushStateWhenCoordinatoris set totrue, thepushStateTimeoutparameter 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
remoteCacheNameattribute 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
fetchPersistentStateattribute, 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
sharedattribute is set totruewhen multiple cache instances share a cache store, which prevents multiple cache instances writing the same modification individually. The default for this attribute isfalse. - The
preloadattribute ensures that the cache store data is pre-loaded into memory and is immediately accessible after starting up. The disadvantage of setting this totrueis that the start up time increases. The default value for this attribute isfalse. - The
ignoreModificationsattribute 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
purgeOnStartupattribute ensures that the cache store is purged during the start up process. The default value for this attribute isfalse. - The
tcpNoDelayattribute triggers theTCPNODELAYstack. The default value for this attribute istrue. - The
pingOnStartupattribute sends a ping request to a back end server to fetch the cluster topology. The default value for this attribute istrue. - The
keySizeEstimateattribute provides an estimation of the key size. The default value for this attribute is64. - The
valueSizeEstimateattribute specifies the size of the byte buffers when serializing and deserializing values. The default value for this attribute is512. - The
forceReturnValuesattribute sets whetherFORCE_RETURN_VALUEis enabled for all calls. The default value for this attribute isfalse.
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
hostattribute configures the host address. - The
portattribute configures the port used by the Remote Cache Store.
- The
maxActiveattribute indicates the maximum number of active connections for each server at a time. The default value for this attribute is-1which indicates an infinite number of active connections. - The
maxIdleattribute indicates the maximum number of idle connections for each server at a time. The default value for this attribute is-1which indicates an infinite number of idle connections. - The
maxTotalattribute indicates the maximum number of persistent connections within the combined set of servers. The default setting for this attribute is-1which indicates an infinite number of connections. - The
connectionUrlparameter specifies the JDBC driver-specific connection URL. - The
usernameparameter contains the username used to connect via theconnectionUrl. - The
driverClassparameter specifies the class name of the driver used to connect to the database.
- The
locationparameter specifies the location to store the primary cache store. The directory is automatically created if it does not exist. - The
expiredLocationparameter 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
sharedparameter specifies whether the cache store is shared. The only supported value for this parameter in the LevelDB cache store isfalse. - The
preloadparameter specifies whether the cache store will be pre-loaded. Valid values aretrueandfalse.
- The
persistenceUnitNameattribute specifies the name of the JPA cache store. - The
entityClassNameattribute 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
fetchPersistentStateparameter determines whether the persistent state is fetched when joining a cluster. Set this totrueif 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. ThefetchPersistentStateparameter isfalseby default. - The
ignoreModificationsparameter 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
purgeOnStartupparameter specifies whether the cache store is purged when initially started. - The
key2StringMapperparameter specifies the class name of the Key2StringMapper used to map keys to strings for the database tables.
- The
dropOnExitparameter specifies whether the database tables are dropped upon shutdown. - The
createOnStartparameter specifies whether the database tables are created by the store on startup. - The
prefixparameter defines the string prepended to name of the target cache when composing the name of the cache bucket table.
- The
nameparameter specifies the name of the column used. - The
typeparameter specifies the type of the column used.
- The
classparameter specifies the class name of the cache store implementation. - The
preloadparameter specifies whether to load entries into the cache during start up. Valid values for this parameter aretrueandfalse. - The
sharedparameter specifies whether the cache store is shared. This is used when multiple cache instances share a cache store. Valid values for this parameter aretrueandfalse.
- The
nameparameter specifies the name of the property. - The
valueparameter specifies the value of the property.