15.3. JdbcMixedStores
The
JdbcMixedStore
is a hybrid implementation that delegates keys based on their type to either the JdbcBinaryStore
or JdbcStringBasedStore
.
15.3.1. JdbcMixedStore Configuration (Remote Client-Server Mode)
The following is a configuration for a
JdbcMixedStore
for Red Hat JBoss Data Grid's Remote Client-Server mode with Passivation enabled.
Procedure 15.8. Configure JdbcMixedStore in Remote Client-Server Mode
The mixed-keyed-jdbc-store Element
Themixed-keyed-jdbc-store
element specifies the configuration for a mixed keyed cache JDBC store.- The
datasource
parameter defines the name of a JNDI for the datasource. - The
passivation
parameter determines whether entries in the cache are passivated (true
) or if the cache store retains a copy of the contents in memory (false
). - The
preload
parameter specifies whether to load entries into the cache during start up. Valid values for this parameter aretrue
andfalse
. - The
purge
parameter specifies whether or not the cache store is purged when it is started. Valid values for this parameter aretrue
andfalse
.
<local-cache> <mixed-keyed-jdbc-store datasource="java:jboss/datasources/JdbcDS" passivation="true" preload="false" purge="false">
The binary-keyed-table Element
Thebinary-keyed-table
element specifies information about the database table used to store mixed cache entries.- The
prefix
parameter specifies a prefix string for the database table name.
<local-cache> <mixed-keyed-jdbc-store datasource="java:jboss/datasources/JdbcDS" passivation="true" preload="false" purge="false"> <binary-keyed-table prefix="MIX_BKT2"> <id-column name="id" type="${id.column.type}"/> <data-column name="datum" type="${data.column.type}"/> <timestamp-column name="version" type="${timestamp.column.type}"/> </binary-keyed-table>
The string-keyed-table Element
Thestring-keyed-table
element specifies information about the database table used to store string based cache entries.- The
prefix
parameter specifies a prefix string for the database table name.
<local-cache> <mixed-keyed-jdbc-store datasource="java:jboss/datasources/JdbcDS" passivation="true" preload="false" purge="false"> <binary-keyed-table prefix="MIX_BKT2"> <id-column name="id" type="${id.column.type}"/> <data-column name="datum" type="${data.column.type}"/> <timestamp-column name="version" type="${timestamp.column.type}"/> </binary-keyed-table> <string-keyed-table prefix="MIX_STR2">
The id-column Element
Theid-column
element specifies information about a database column that holds cache entry IDs.- The
name
parameter specifies the name of the ID column. - The
type
parameter specifies the type of the ID column.
<local-cache> <mixed-keyed-jdbc-store datasource="java:jboss/datasources/JdbcDS" passivation="true" preload="false" purge="false"> <binary-keyed-table prefix="MIX_BKT2"> <id-column name="id" type="${id.column.type}"/> <data-column name="datum" type="${data.column.type}"/> <timestamp-column name="version" type="${timestamp.column.type}"/> </binary-keyed-table> <string-keyed-table prefix="MIX_STR2"> <id-column name="id" type="${id.column.type}"/>
The data-column Element
Thedata-column
element contains information about a database column that holds cache entry data.- The
name
parameter specifies the name of the database column. - The
type
parameter specifies the type of the database column.
<local-cache> <mixed-keyed-jdbc-store datasource="java:jboss/datasources/JdbcDS" passivation="true" preload="false" purge="false"> <binary-keyed-table prefix="MIX_BKT2"> <id-column name="id" type="${id.column.type}"/> <data-column name="datum" type="${data.column.type}"/> <timestamp-column name="version" type="${timestamp.column.type}"/> </binary-keyed-table> <string-keyed-table prefix="MIX_STR2"> <id-column name="id" type="${id.column.type}"/> <data-column name="datum" type="${data.column.type}"/>
The timestamp-column Element
Thetimestamp-column
element specifies information about the database column that holds cache entry timestamps.- The
name
parameter specifies the name of the timestamp column. - The
type
parameter specifies the type of the timestamp column.
<local-cache> <mixed-keyed-jdbc-store datasource="java:jboss/datasources/JdbcDS" passivation="true" preload="false" purge="false"> <binary-keyed-table prefix="MIX_BKT2"> <id-column name="id" type="${id.column.type}"/> <data-column name="datum" type="${data.column.type}"/> <timestamp-column name="version" type="${timestamp.column.type}"/> </binary-keyed-table> <string-keyed-table prefix="MIX_STR2"> <id-column name="id" type="${id.column.type}"/> <data-column name="datum" type="${data.column.type}"/> <timestamp-column name="version" type="${timestamp.column.type}"/> </string-keyed-table> </mixed-keyed-jdbc-store> </local-cache> </cache-container> </subsystem>