Class 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:
    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>
    • Field Summary

      • Fields inherited from class org.infinispan.persistence.jdbc.common.impl.BaseJdbcStore

        blockingManager, config, connectionFactory, tableOperations, transactionConnectionMap
      • Fields inherited from interface org.infinispan.persistence.spi.NonBlockingStore

        SIZE_UNAVAILABLE_FUTURE
    • Constructor Detail

      • JdbcStringBasedStore

        public JdbcStringBasedStore()
    • Method Detail

      • characteristics

        public Set<org.infinispan.persistence.spi.NonBlockingStore.Characteristic> characteristics()
        Specified by:
        characteristics in interface org.infinispan.persistence.spi.NonBlockingStore<K,​V>
        Overrides:
        characteristics in class org.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:
        createTableOperations in class org.infinispan.persistence.jdbc.common.impl.BaseJdbcStore<K,​V,​JdbcStringBasedStoreConfiguration>
      • extraStopSteps

        protected void extraStopSteps()
        Overrides:
        extraStopSteps in class org.infinispan.persistence.jdbc.common.impl.BaseJdbcStore<K,​V,​JdbcStringBasedStoreConfiguration>
      • size

        public CompletionStage<Long> size​(org.infinispan.commons.util.IntSet segments)
        Specified by:
        size in interface org.infinispan.persistence.spi.NonBlockingStore<K,​V>
        Overrides:
        size in class org.infinispan.persistence.jdbc.common.impl.BaseJdbcStore<K,​V,​JdbcStringBasedStoreConfiguration>
      • approximateSize

        public CompletionStage<Long> approximateSize​(org.infinispan.commons.util.IntSet segments)
        Specified by:
        approximateSize in interface org.infinispan.persistence.spi.NonBlockingStore<K,​V>
        Overrides:
        approximateSize in class org.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()
      • purgeExpired

        public org.reactivestreams.Publisher<org.infinispan.persistence.spi.MarshallableEntry<K,​V>> purgeExpired()