org.apache.ignite.cache.store.cassandra

## Class CassandraCacheStore<K,V>

- java.lang.Object
- - org.apache.ignite.cache.store.cassandra.CassandraCacheStore<K,V>

- Type Parameters:
    `K` - Ignite cache key type.
    `V` - Ignite cache value type.
  All Implemented Interfaces:
    javax.cache.integration.CacheLoader<K,V>, javax.cache.integration.CacheWriter<K,V>, CacheStore<K,V>

      public class CassandraCacheStore<K,V>
      extends Object
      implements CacheStore<K,V>

  Implementation of `CacheStore` backed by Cassandra database.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `CassandraCacheStore(DataSource dataSrc, KeyValuePersistenceSettings settings, int maxPoolSize)` Store constructor.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `delete(Object key)`
    `void` | `deleteAll(Collection<?> keys)`
    `V` | `load(K key)`
    `Map<K,V>` | `loadAll(Iterable<? extends K> keys)`
    `void` | `loadCache(IgniteBiInClosure<K,V> clo, Object... args)` Loads all values from underlying persistent storage.
    `void` | `sessionEnd(boolean commit)` Tells store to commit or rollback a transaction depending on the value of the `'commit'` parameter.
    `String` | `toString()`
    `void` | `write(javax.cache.Cache.Entry<? extends K,? extends V> entry)`
    `void` | `writeAll(Collection<javax.cache.Cache.Entry<? extends K,? extends V>> entries)`

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

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

- - ### Constructor Detail

    - #### CassandraCacheStore

          public CassandraCacheStore(DataSource dataSrc,
                                     KeyValuePersistenceSettings settings,
                                     int maxPoolSize)

      Store constructor.
      Parameters:
        `dataSrc` - Data source.
        `settings` - Persistence settings for Ignite key and value objects.
        `maxPoolSize` - Max workers thread count.

  - ### Method Detail

    - #### loadCache

          public void loadCache(IgniteBiInClosure<K,V> clo,
                                Object... args)
                         throws javax.cache.integration.CacheLoaderException

      Loads all values from underlying persistent storage. Note that keys are not passed, so it is up to implementation to figure out what to load. This method is called whenever `IgniteCache.loadCache(IgniteBiPredicate, Object...)` method is invoked which is usually to preload the cache from persistent storage.

      This method is optional, and cache implementation does not depend on this method to do anything. Default implementation of this method in `CacheStoreAdapter` does nothing.

      For every loaded value method `IgniteBiInClosure.apply(Object, Object)` should be called on the passed in closure. The closure will then make sure that the loaded value is stored in cache.

      Specified by:
        `loadCache` in interface `CacheStore<K,V>`
      Parameters:
        `clo` - Closure for loaded values.
        `args` - Arguments passes into `IgniteCache.loadCache(IgniteBiPredicate, Object...)` method.
      Throws:
        `javax.cache.integration.CacheLoaderException` - If loading failed.

    - #### sessionEnd

          public void sessionEnd(boolean commit)
                          throws javax.cache.integration.CacheWriterException

      Tells store to commit or rollback a transaction depending on the value of the `'commit'` parameter.
      Specified by:
        `sessionEnd` in interface `CacheStore<K,V>`
      Parameters:
        `commit` - `True` if transaction should commit, `false` for rollback.
      Throws:
        `javax.cache.integration.CacheWriterException` - If commit or rollback failed. Note that commit failure in some cases may bring cache transaction into `TransactionState.UNKNOWN` which will consequently cause all transacted entries to be invalidated.

    - #### load

          public V load(K key)
                 throws javax.cache.integration.CacheLoaderException

      Specified by:
        `load` in interface `javax.cache.integration.CacheLoader<K,V>`
      Throws:
        `javax.cache.integration.CacheLoaderException`

    - #### loadAll

          public Map<K,V> loadAll(Iterable<? extends K> keys)
                           throws javax.cache.integration.CacheLoaderException

      Specified by:
        `loadAll` in interface `javax.cache.integration.CacheLoader<K,V>`
      Throws:
        `javax.cache.integration.CacheLoaderException`

    - #### write

          public void write(javax.cache.Cache.Entry<? extends K,? extends V> entry)
                     throws javax.cache.integration.CacheWriterException

      Specified by:
        `write` in interface `javax.cache.integration.CacheWriter<K,V>`
      Throws:
        `javax.cache.integration.CacheWriterException`

    - #### writeAll

          public void writeAll(Collection<javax.cache.Cache.Entry<? extends K,? extends V>> entries)
                        throws javax.cache.integration.CacheWriterException

      Specified by:
        `writeAll` in interface `javax.cache.integration.CacheWriter<K,V>`
      Throws:
        `javax.cache.integration.CacheWriterException`

    - #### delete

          public void delete(Object key)
                      throws javax.cache.integration.CacheWriterException

      Specified by:
        `delete` in interface `javax.cache.integration.CacheWriter<K,V>`
      Throws:
        `javax.cache.integration.CacheWriterException`

    - #### deleteAll

          public void deleteAll(Collection<?> keys)
                         throws javax.cache.integration.CacheWriterException

      Specified by:
        `deleteAll` in interface `javax.cache.integration.CacheWriter<K,V>`
      Throws:
        `javax.cache.integration.CacheWriterException`

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

2022 Copyright © Apache Software Foundation
| Follow @ApacheIgnite
Ignite Database and Caching Platform | : ver. 2.13.0
Release Date | : April 20 2022