Show / Hide Table of Contents

# Namespace Apache.Ignite.Core.Cache.Store

### Classes

#### CacheParallelLoadStoreAdapter<TK, TV, TData>

Cache storage adapter with parallel loading in LoadAll method.

#### CacheStoreAdapter<TK, TV>

Cache storage convenience adapter. It provides default implementation for bulk operations, such as `LoadAll`, `PutAll` and `RemoveAll` by sequentially calling corresponding `Load`, `Put` and `Remove` operations. Use this adapter whenever such behaviour is acceptable. However in many cases it maybe more preferable to take advantage of database batch update functionality, and therefore default adapter implementation may not be the best option.

Note that `LoadCache` method has empty implementation because it is essentially up to the user to invoke it with specific arguments.

#### CacheStoreException

Indicates an error during CacheStore operation.

### Interfaces

#### ICacheStore

Non-generic base type for ICacheStore<TK, TV>, used only for configuration property. Users should implement generic ICacheStore<TK, TV>.

#### ICacheStore<TK, TV>

API for cache persistent storage for read-through and write-through behavior.

Generic argument types depend on KeepBinaryInStore property. When `true` (default), cache store operates on IBinaryObject instances. Otherwise, generic arguments should be the same as in corresponding ICache<TK, TV>.

Persistent store is configured in Ignite's Spring XML configuration file via `CacheConfiguration.setStore()` property. If you have an implementation of cache store in .NET, you should use special Java wrapper which accepts assembly name and class name of .NET store implementation (both properties are mandatory).

Optionally, you may specify "properies" property to set any property values on an instance of your store. Here is an example:

    <bean class="org.apache.ignite.configuration.CacheConfiguration">
        ...
        <property name="cacheStoreFactory">
            <bean class="org.apache.ignite.platform.dotnet.PlatformDotNetCacheStoreFactory">
                <property name="assemblyName" value="MyAssembly"/>
                <property name="className" value="MyApp.MyCacheStore"/>
                <property name="properties">
                    <map>
                        <entry key="IntProperty">
                            <value type="java.lang.Integer">42</value>
                        </entry>
                        <entry key="StringProperty" value="String value"/>
                    </map>
                </property>
            </bean>
        </property>
        ...
    </bean>

Assemply name and class name are passed to System.Activator.CreateInstance(String, String) method during node startup to create an instance of cache store. Refer to its documentation for details.

All transactional operations of this API are provided with ongoing ITransaction, if any. You can attach any metadata to transaction, e.g. to recognize if several operations belong to the same transaction or not. Here is an example of how attach a ODBC connection as transaction metadata:

    OdbcConnection conn = tx.Meta("some.name");

    if (conn == null)
    {
        conn = ...; // Create or get connection.

        // Store connection in transaction metadata, so it can be accessed
        // for other operations on the same transaction.
        tx.AddMeta("some.name", conn);
    }

#### ICacheStoreSession

Session for the cache store operations. The main purpose of cache store session is to hold context between multiple store invocations whenever in transaction. For example, you can save current database connection in the session Properties map. You can then commit this connection in the SessionEnd(Boolean) method.