public class JdbcMixedStore extends Object implements org.infinispan.persistence.spi.AdvancedLoadWriteStore
JdbcBinaryStore
and JdbcStringBasedStore
. It
aggregates an instance of JdbcBinaryStore and JdbcStringBasedStore, delegating work to one of them
(sometimes both, see below) based on the passed in key. In order to determine which store to use it will rely on the
configured Key2StringMapper
)(see configuration).
The advantage it brings is the possibility of efficiently storing string(able) keyed InternalCacheEntry
s, and at the same time being able to store any other keys, a la
JdbcBinaryStore
.
There will only be a performance cost for the aggregate operations: loadAll, fromStream, toStream and clear. For
these operations there will be two distinct database call, one for each JdbcStore implementation. Most of application
are only using these operations at lifecycles changes (e.g. fromStream and toStream at cluster join time, loadAll at
startup for warm caches), so performance drawback shouldn't be significant (again, most of the cases).
Resource sharing - both aggregated cache stores have locks and connection pools. The locking is not shared, each
loader keeping its own StripedLock
instance. Also the tables (even though
similar as definition) are different in order to avoid key collision. On the other hand, the connection pooling is a
shared resource.JdbcBinaryStore
,
JdbcStringBasedStore
Constructor and Description |
---|
JdbcMixedStore() |
Modifier and Type | Method and Description |
---|---|
void |
clear() |
boolean |
contains(Object key) |
boolean |
delete(Object key) |
JdbcBinaryStore |
getBinaryStore() |
JdbcMixedStoreConfiguration |
getConfiguration() |
ConnectionFactory |
getConnectionFactory() |
JdbcStringBasedStore |
getStringStore() |
void |
init(org.infinispan.persistence.spi.InitializationContext ctx) |
org.infinispan.marshall.core.MarshalledEntry |
load(Object key) |
void |
process(org.infinispan.filter.KeyFilter filter,
org.infinispan.persistence.spi.AdvancedCacheLoader.CacheLoaderTask task,
Executor executor,
boolean fetchValue,
boolean fetchMetadata) |
void |
purge(Executor threadPool,
org.infinispan.persistence.spi.AdvancedCacheWriter.PurgeListener task) |
int |
size() |
void |
start() |
void |
stop() |
void |
write(org.infinispan.marshall.core.MarshalledEntry ed) |
public void init(org.infinispan.persistence.spi.InitializationContext ctx)
init
in interface org.infinispan.persistence.spi.CacheLoader
init
in interface org.infinispan.persistence.spi.CacheWriter
public void start()
start
in interface org.infinispan.commons.api.Lifecycle
public void stop()
stop
in interface org.infinispan.commons.api.Lifecycle
public void purge(Executor threadPool, org.infinispan.persistence.spi.AdvancedCacheWriter.PurgeListener task)
purge
in interface org.infinispan.persistence.spi.AdvancedCacheWriter
public org.infinispan.marshall.core.MarshalledEntry load(Object key)
load
in interface org.infinispan.persistence.spi.CacheLoader
public void process(org.infinispan.filter.KeyFilter filter, org.infinispan.persistence.spi.AdvancedCacheLoader.CacheLoaderTask task, Executor executor, boolean fetchValue, boolean fetchMetadata)
process
in interface org.infinispan.persistence.spi.AdvancedCacheLoader
public void write(org.infinispan.marshall.core.MarshalledEntry ed)
write
in interface org.infinispan.persistence.spi.CacheWriter
public boolean delete(Object key)
delete
in interface org.infinispan.persistence.spi.CacheWriter
public int size()
size
in interface org.infinispan.persistence.spi.AdvancedCacheLoader
public boolean contains(Object key)
contains
in interface org.infinispan.persistence.spi.CacheLoader
public void clear()
clear
in interface org.infinispan.persistence.spi.AdvancedCacheWriter
public ConnectionFactory getConnectionFactory()
public JdbcBinaryStore getBinaryStore()
public JdbcStringBasedStore getStringStore()
public JdbcMixedStoreConfiguration getConfiguration()
Copyright © 2017 JBoss, a division of Red Hat. All rights reserved.