Class JdbcStringBasedStore<K,V>
java.lang.Object
org.infinispan.persistence.jdbc.common.impl.BaseJdbcStore<K, V, JdbcStringBasedStoreConfiguration>
org.infinispan.persistence.jdbc.stringbased.JdbcStringBasedStore<K,V>
- All Implemented Interfaces:
org.infinispan.persistence.spi.NonBlockingStore<K,V>
public class JdbcStringBasedStore<K,V>
extends org.infinispan.persistence.jdbc.common.impl.BaseJdbcStore<K, V, JdbcStringBasedStoreConfiguration>
AdvancedCacheLoader implementation that stores the entries in a database.
This cache store will store each entry within a row in the table. This assures a finer grained granularity for all
operation, and better performance. In order to be able to store non-string keys, it relies on an Key2StringMapper.
Note that only the keys are stored as strings, the values are still saved as binary data. Using a character
data type for the value column will result in unmarshalling errors.
The actual storage table is defined through configuration JdbcStringBasedStoreConfiguration.
The table can be created/dropped on-the-fly, at deployment time. For more details consult javadoc for JdbcStringBasedStoreConfiguration.
Preload.In order to support preload functionality the store needs to read the string keys from the database and transform them
into the corresponding key objects. Key2StringMapper only supports
key to string transformation(one way); in order to be able to use preload one needs to specify an
TwoWayKey2StringMapper, which extends Key2StringMapper and
allows bidirectional transformation.
Rehashing. When a node leaves/joins, Infinispan moves around persistent state as part of rehashing process.
For this it needs access to the underlaying key objects, so if distribution is used, the mapper needs to be an
TwoWayKey2StringMapper otherwise the cache won't start (same constraint as with preloading).- Author:
- Mircea.Markus@jboss.com
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.infinispan.persistence.spi.NonBlockingStore
org.infinispan.persistence.spi.NonBlockingStore.Characteristic, org.infinispan.persistence.spi.NonBlockingStore.SegmentedPublisher<Type> -
Field Summary
Fields inherited from class org.infinispan.persistence.jdbc.common.impl.BaseJdbcStore
blockingManager, config, connectionFactory, tableOperations, transactionConnectionMapFields inherited from interface org.infinispan.persistence.spi.NonBlockingStore
SIZE_UNAVAILABLE_FUTURE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddSegments(org.infinispan.commons.util.IntSet segments) approximateSize(org.infinispan.commons.util.IntSet segments) Set<org.infinispan.persistence.spi.NonBlockingStore.Characteristic> createTableOperations(org.infinispan.persistence.spi.InitializationContext ctx, JdbcStringBasedStoreConfiguration configuration) protected voidorg.infinispan.persistence.jdbc.common.connectionfactory.ConnectionFactoryremoveSegments(org.infinispan.commons.util.IntSet segments) size(org.infinispan.commons.util.IntSet segments) Methods inherited from class org.infinispan.persistence.jdbc.common.impl.BaseJdbcStore
batch, clear, commit, delete, destroyTxConnection, getTxConnection, isAvailable, load, prepareWithModifications, publishEntries, publishKeys, rollback, start, stop, writeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.infinispan.persistence.spi.NonBlockingStore
containsKey, destroy, ignoreCommandWithFlags
-
Constructor Details
-
JdbcStringBasedStore
public JdbcStringBasedStore()
-
-
Method Details
-
characteristics
- Specified by:
characteristicsin interfaceorg.infinispan.persistence.spi.NonBlockingStore<K,V> - Overrides:
characteristicsin classorg.infinispan.persistence.jdbc.common.impl.BaseJdbcStore<K, V, JdbcStringBasedStoreConfiguration>
-
createTableOperations
protected org.infinispan.persistence.jdbc.common.TableOperations<K,V> createTableOperations(org.infinispan.persistence.spi.InitializationContext ctx, JdbcStringBasedStoreConfiguration configuration) - Specified by:
createTableOperationsin classorg.infinispan.persistence.jdbc.common.impl.BaseJdbcStore<K, V, JdbcStringBasedStoreConfiguration>
-
getTableManager
-
extraStopSteps
protected void extraStopSteps()- Overrides:
extraStopStepsin classorg.infinispan.persistence.jdbc.common.impl.BaseJdbcStore<K, V, JdbcStringBasedStoreConfiguration>
-
size
- Specified by:
sizein interfaceorg.infinispan.persistence.spi.NonBlockingStore<K,V> - Overrides:
sizein classorg.infinispan.persistence.jdbc.common.impl.BaseJdbcStore<K, V, JdbcStringBasedStoreConfiguration>
-
approximateSize
- Specified by:
approximateSizein interfaceorg.infinispan.persistence.spi.NonBlockingStore<K,V> - Overrides:
approximateSizein classorg.infinispan.persistence.jdbc.common.impl.BaseJdbcStore<K, V, JdbcStringBasedStoreConfiguration>
-
addSegments
-
removeSegments
-
getConnectionFactory
public org.infinispan.persistence.jdbc.common.connectionfactory.ConnectionFactory getConnectionFactory() -
purgeExpired
-