org.apache.ignite.internal.processors.cache.store

## Class GridCacheStoreManagerAdapter

- java.lang.Object
- - org.apache.ignite.internal.processors.cache.GridCacheManagerAdapter
  - - org.apache.ignite.internal.processors.cache.store.GridCacheStoreManagerAdapter

All Implemented Interfaces:
  GridCacheManager, CacheStoreManager

Direct Known Subclasses:
  CacheOsStoreManager

    public abstract class GridCacheStoreManagerAdapter
    extends GridCacheManagerAdapter
    implements CacheStoreManager

Store manager.

### Field Summary

Fields
`protected boolean` `alwaysKeepBinary` Always keep binary.
`protected CacheStore<?,?>` `cfgStore`
`protected CacheStore<Object,Object>` `store`

### Fields inherited from class org.apache.ignite.internal.processors.cache.GridCacheManagerAdapter

`cctx, log, starting`

### Constructor Summary

Constructors
Constructor and Description
`GridCacheStoreManagerAdapter()`

### Method Summary

All Methods Instance Methods Abstract Methods Concrete Methods
`protected abstract CacheConfiguration` `cacheConfiguration()`
`boolean` `configured()`
`CacheStore<?,?>` `configuredStore()`
`void` `forceFlush()`
`protected abstract GridKernalContext` `igniteContext()`
`void` `initialize(@Nullable CacheStore cfgStore, Map sesHolders)` Initialize store manager.
`boolean` `isLocal()`
`boolean` `isWriteBehind()`
`boolean` `isWriteThrough()`
`boolean` `isWriteToStoreFromDht()`
`@Nullable Object` `load(@Nullable IgniteInternalTx tx, KeyCacheObject key)` Loads data from persistent store.
`boolean` `loadAll(@Nullable IgniteInternalTx tx, Collection keys, IgniteBiInClosure vis)` Loads data from persistent store.
`boolean` `loadCache(GridInClosure3 vis, Object[] args)` Loads data from persistent store.
`void` `localStoreLoadAll(@Nullable IgniteInternalTx tx, Collection keys, GridInClosure3 vis)`
`boolean` `put(@Nullable IgniteInternalTx tx, KeyCacheObject key, CacheObject val, GridCacheVersion ver)` Puts key-value pair into storage.
`boolean` `putAll(@Nullable IgniteInternalTx tx, Map<? extends KeyCacheObject,IgniteBiTuple<? extends CacheObject,GridCacheVersion>> map)` Puts key-value pair into storage.
`boolean` `remove(@Nullable IgniteInternalTx tx, KeyCacheObject key)`
`boolean` `removeAll(@Nullable IgniteInternalTx tx, Collection<? extends KeyCacheObject> keys)`
`void` `sessionEnd(IgniteInternalTx tx, boolean commit, boolean last, boolean storeSessionEnded)`
`protected void` `start0()`
`protected void` `stop0(boolean cancel, boolean destroy)`
`CacheStore<Object,Object>` `store()`
`void` `writeBehindCacheStoreSessionListenerStart()` Notifies cache store session listeners.
`void` `writeBehindSessionEnd(boolean threwEx)` End session initiated by write-behind store.
`void` `writeBehindSessionInit()` Start session initiated by write-behind store.

### Methods inherited from class org.apache.ignite.internal.processors.cache.GridCacheManagerAdapter

`context, kernalStartInfo, kernalStopInfo, log, onDisconnected, onKernalStart, onKernalStart0, onKernalStop, onKernalStop0, printMemoryStats, start, startInfo, stop, stopInfo, toString`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Methods inherited from interface org.apache.ignite.internal.processors.cache.store.CacheStoreManager

`configuredConvertBinary, convertBinary`

### Methods inherited from interface org.apache.ignite.internal.processors.cache.GridCacheManager

`onDisconnected, onKernalStart, onKernalStop, printMemoryStats, start, stop`

### Field Detail

#### store

    protected CacheStore<Object,Object> store

#### cfgStore

    protected CacheStore<?,?> cfgStore

#### alwaysKeepBinary

    protected boolean alwaysKeepBinary

Always keep binary.

### Constructor Detail

#### GridCacheStoreManagerAdapter

    public GridCacheStoreManagerAdapter()

### Method Detail

#### initialize

    public void initialize(@Nullable
                           @Nullable CacheStore cfgStore,
                           Map sesHolders)
                    throws IgniteCheckedException

Initialize store manager.

Specified by:
  `initialize` in interface `CacheStoreManager`
Parameters:
  `cfgStore` - Actual store.
  `sesHolders` - Session holders.
Throws:
  `IgniteCheckedException` - If failed.

#### isWriteThrough

    public boolean isWriteThrough()

Specified by:
  `isWriteThrough` in interface `CacheStoreManager`
Returns:
  `True` is write-through is enabled.

#### start0

    protected void start0()
                   throws IgniteCheckedException

Overrides:
  `start0` in class `GridCacheManagerAdapter`
Throws:
  `IgniteCheckedException` - If failed.

#### stop0

    protected void stop0(boolean cancel,
                         boolean destroy)

Overrides:
  `stop0` in class `GridCacheManagerAdapter`
Parameters:
  `cancel` - Cancel flag.
  `destroy` - Cache destroy flag.

#### isLocal

    public boolean isLocal()

Specified by:
  `isLocal` in interface `CacheStoreManager`
Returns:
  `true` If local store is configured.

#### configured

    public boolean configured()

Specified by:
  `configured` in interface `CacheStoreManager`
Returns:
  `true` If store configured.

#### configuredStore

    public CacheStore<?,?> configuredStore()

Specified by:
  `configuredStore` in interface `CacheStoreManager`
Returns:
  Unwrapped store provided in configuration.

#### load

    @Nullable
    public final @Nullable Object load(@Nullable
                                                 @Nullable IgniteInternalTx tx,
                                                 KeyCacheObject key)
                                          throws IgniteCheckedException

Loads data from persistent store.

Specified by:
  `load` in interface `CacheStoreManager`
Parameters:
  `tx` - Cache transaction.
  `key` - Cache key.
Returns:
  Loaded value, possibly `null`.
Throws:
  `IgniteCheckedException` - If data loading failed.

#### isWriteBehind

    public boolean isWriteBehind()

Specified by:
  `isWriteBehind` in interface `CacheStoreManager`
Returns:
  `True` is write-behind is enabled.

#### isWriteToStoreFromDht

    public boolean isWriteToStoreFromDht()

Specified by:
  `isWriteToStoreFromDht` in interface `CacheStoreManager`
Returns:
  Whether DHT transaction can write to store from DHT.

#### localStoreLoadAll

    public final void localStoreLoadAll(@Nullable
                                        @Nullable IgniteInternalTx tx,
                                        Collection keys,
                                        GridInClosure3 vis)
                                 throws IgniteCheckedException

Specified by:
  `localStoreLoadAll` in interface `CacheStoreManager`
Parameters:
  `tx` - Cache transaction.
  `keys` - Cache keys.
  `vis` - Closure to apply for loaded elements.
Throws:
  `IgniteCheckedException` - If data loading failed.

#### loadAll

    public final boolean loadAll(@Nullable
                                 @Nullable IgniteInternalTx tx,
                                 Collection keys,
                                 IgniteBiInClosure vis)
                          throws IgniteCheckedException

Loads data from persistent store.

Specified by:
  `loadAll` in interface `CacheStoreManager`
Parameters:
  `tx` - Cache transaction.
  `keys` - Cache keys.
  `vis` - Closure.
Returns:
  `True` if there is a persistent storage.
Throws:
  `IgniteCheckedException` - If data loading failed.

#### loadCache

    public final boolean loadCache(GridInClosure3 vis,
                                   Object[] args)
                            throws IgniteCheckedException

Loads data from persistent store.

Specified by:
  `loadCache` in interface `CacheStoreManager`
Parameters:
  `vis` - Closer to cache loaded elements.
  `args` - User arguments.
Returns:
  `True` if there is a persistent storage.
Throws:
  `IgniteCheckedException` - If data loading failed.

#### put

    public final boolean put(@Nullable
                             @Nullable IgniteInternalTx tx,
                             KeyCacheObject key,
                             CacheObject val,
                             GridCacheVersion ver)
                      throws IgniteCheckedException

Puts key-value pair into storage.

Specified by:
  `put` in interface `CacheStoreManager`
Parameters:
  `tx` - Cache transaction.
  `key` - Key.
  `val` - Value.
  `ver` - Version.
Returns:
  `true` If there is a persistent storage.
Throws:
  `IgniteCheckedException` - If storage failed.

#### putAll

    public final boolean putAll(@Nullable
                                @Nullable IgniteInternalTx tx,
                                Map<? extends KeyCacheObject,IgniteBiTuple<? extends CacheObject,GridCacheVersion>> map)
                         throws IgniteCheckedException

Puts key-value pair into storage.

Specified by:
  `putAll` in interface `CacheStoreManager`
Parameters:
  `tx` - Cache transaction.
  `map` - Map.
Returns:
  `True` if there is a persistent storage.
Throws:
  `IgniteCheckedException` - If storage failed.

#### remove

    public final boolean remove(@Nullable
                                @Nullable IgniteInternalTx tx,
                                KeyCacheObject key)
                         throws IgniteCheckedException

Specified by:
  `remove` in interface `CacheStoreManager`
Parameters:
  `tx` - Cache transaction.
  `key` - Key.
Returns:
  `True` if there is a persistent storage.
Throws:
  `IgniteCheckedException` - If storage failed.

#### removeAll

    public final boolean removeAll(@Nullable
                                   @Nullable IgniteInternalTx tx,
                                   Collection<? extends KeyCacheObject> keys)
                            throws IgniteCheckedException

Specified by:
  `removeAll` in interface `CacheStoreManager`
Parameters:
  `tx` - Cache transaction.
  `keys` - Key.
Returns:
  `True` if there is a persistent storage.
Throws:
  `IgniteCheckedException` - If storage failed.

#### store

    public CacheStore<Object,Object> store()

Specified by:
  `store` in interface `CacheStoreManager`
Returns:
  Wrapped store.

#### forceFlush

    public void forceFlush()
                    throws IgniteCheckedException

Specified by:
  `forceFlush` in interface `CacheStoreManager`
Throws:
  `IgniteCheckedException` - If failed.

#### sessionEnd

    public final void sessionEnd(IgniteInternalTx tx,
                                 boolean commit,
                                 boolean last,
                                 boolean storeSessionEnded)
                          throws IgniteCheckedException

Specified by:
  `sessionEnd` in interface `CacheStoreManager`
Parameters:
  `tx` - Transaction.
  `commit` - Commit.
  `last` - `True` if this is last store in transaction.
  `storeSessionEnded` - `True` if session for underlying store already ended.
Throws:
  `IgniteCheckedException` - If failed.

#### writeBehindSessionInit

    public void writeBehindSessionInit()
                                throws IgniteCheckedException

Start session initiated by write-behind store.

Specified by:
  `writeBehindSessionInit` in interface `CacheStoreManager`
Throws:
  `IgniteCheckedException` - If failed.

#### writeBehindCacheStoreSessionListenerStart

    public void writeBehindCacheStoreSessionListenerStart()
                                                   throws IgniteCheckedException

Notifies cache store session listeners. This method is called by write-behind store in case of back-pressure mechanism is initiated. It is assumed that cache store session was started by CacheStoreManager before.

Specified by:
  `writeBehindCacheStoreSessionListenerStart` in interface `CacheStoreManager`
Throws:
  `IgniteCheckedException` - If failed.

#### writeBehindSessionEnd

    public void writeBehindSessionEnd(boolean threwEx)
                               throws IgniteCheckedException

End session initiated by write-behind store.

Specified by:
  `writeBehindSessionEnd` in interface `CacheStoreManager`
Parameters:
  `threwEx` - If exception was thrown.
Throws:
  `IgniteCheckedException` - If failed.

#### igniteContext

    protected abstract GridKernalContext igniteContext()

Returns:
  Ignite context.

#### cacheConfiguration

    protected abstract CacheConfiguration cacheConfiguration()

Returns:
  Cache configuration.

${current.year} Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Database and Caching Platform | : ver. 2.10.0
Release Date | : March 10 2021