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>
AdvancedCacheLoaderimplementation 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 anKey2StringMapper. 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 configurationJdbcStringBasedStoreConfiguration. The table can be created/dropped on-the-fly, at deployment time. For more details consult javadoc forJdbcStringBasedStoreConfiguration. 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.Key2StringMapperonly supports key to string transformation(one way); in order to be able to use preload one needs to specify anTwoWayKey2StringMapper, which extendsKey2StringMapperand 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 anTwoWayKey2StringMapperotherwise the cache won't start (same constraint as with preloading).- Author:
- Mircea.Markus@jboss.com
- See Also:
Key2StringMapper,DefaultTwoWayKey2StringMapper
-
-
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 extends Object>
-
-
Constructor Summary
Constructors Constructor Description JdbcStringBasedStore()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CompletionStage<Void>addSegments(org.infinispan.commons.util.IntSet segments)CompletionStage<Long>approximateSize(org.infinispan.commons.util.IntSet segments)Set<org.infinispan.persistence.spi.NonBlockingStore.Characteristic>characteristics()protected org.infinispan.persistence.jdbc.common.TableOperations<K,V>createTableOperations(org.infinispan.persistence.spi.InitializationContext ctx, JdbcStringBasedStoreConfiguration configuration)protected voidextraStopSteps()org.infinispan.persistence.jdbc.common.connectionfactory.ConnectionFactorygetConnectionFactory()TableManager<K,V>getTableManager()org.reactivestreams.Publisher<org.infinispan.persistence.spi.MarshallableEntry<K,V>>purgeExpired()CompletionStage<Void>removeSegments(org.infinispan.commons.util.IntSet segments)CompletionStage<Long>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, write
-
-
-
-
Method Detail
-
characteristics
public Set<org.infinispan.persistence.spi.NonBlockingStore.Characteristic> 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
public TableManager<K,V> getTableManager()
-
extraStopSteps
protected void extraStopSteps()
- Overrides:
extraStopStepsin classorg.infinispan.persistence.jdbc.common.impl.BaseJdbcStore<K,V,JdbcStringBasedStoreConfiguration>
-
size
public CompletionStage<Long> size(org.infinispan.commons.util.IntSet segments)
- Specified by:
sizein interfaceorg.infinispan.persistence.spi.NonBlockingStore<K,V>- Overrides:
sizein classorg.infinispan.persistence.jdbc.common.impl.BaseJdbcStore<K,V,JdbcStringBasedStoreConfiguration>
-
approximateSize
public CompletionStage<Long> approximateSize(org.infinispan.commons.util.IntSet segments)
- Specified by:
approximateSizein interfaceorg.infinispan.persistence.spi.NonBlockingStore<K,V>- Overrides:
approximateSizein classorg.infinispan.persistence.jdbc.common.impl.BaseJdbcStore<K,V,JdbcStringBasedStoreConfiguration>
-
addSegments
public CompletionStage<Void> addSegments(org.infinispan.commons.util.IntSet segments)
-
removeSegments
public CompletionStage<Void> removeSegments(org.infinispan.commons.util.IntSet segments)
-
getConnectionFactory
public org.infinispan.persistence.jdbc.common.connectionfactory.ConnectionFactory getConnectionFactory()
-
-