org.apache.ignite.cache.store

## Class CacheStoreAdapter<K,V>

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

- All Implemented Interfaces:
    javax.cache.integration.CacheLoader<K,V>, javax.cache.integration.CacheWriter<K,V>, CacheStore<K,V>
  Direct Known Subclasses:
    CacheJdbcBlobStore

      public abstract class CacheStoreAdapter<K,V>
      extends Object
      implements CacheStore<K,V>

  Cache storage convenience adapter. It provides default implementation for bulk operations, such as `loadAll(Iterable)`, `writeAll(Collection)`, and `deleteAll(Collection)` by sequentially calling corresponding `CacheLoader.load(Object)`, `CacheWriter.write(Cache.Entry)`, and `CacheWriter.delete(Object)` 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 method `loadCache(IgniteBiInClosure, Object...)` has empty implementation because it is essentially up to the user to invoke it with specific arguments.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `CacheStoreAdapter()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `deleteAll(Collection<?> keys)`
    `Map<K,V>` | `loadAll(Iterable<? extends K> keys)`
    `void` | `loadCache(IgniteBiInClosure<K,V> clo, Object... args)` Default empty implementation.
    `void` | `sessionEnd(boolean commit)` Default empty implementation for ending transactions.
    `String` | `toString()`
    `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`

    - ### Methods inherited from interface javax.cache.integration.CacheLoader

      `load`

    - ### Methods inherited from interface javax.cache.integration.CacheWriter

      `delete, write`

- - ### Constructor Detail

    - #### CacheStoreAdapter

          public CacheStoreAdapter()

  - ### Method Detail

    - #### loadCache

          public void loadCache(IgniteBiInClosure<K,V> clo,
                                Object... args)

      Default empty implementation. This method needs to be overridden only if `IgniteCache.loadCache(IgniteBiPredicate, Object...)` method is explicitly called.
      Specified by:
        `loadCache` in interface `CacheStore<K,V>`
      Parameters:
        `clo` - Closure for loaded values.
        `args` - Arguments passes into `IgniteCache.loadCache(IgniteBiPredicate, Object...)` method.

    - #### loadAll

          public Map<K,V> loadAll(Iterable<? extends K> keys)

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

    - #### writeAll

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

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

    - #### deleteAll

          public void deleteAll(Collection<?> keys)

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

    - #### sessionEnd

          public void sessionEnd(boolean commit)

      Default empty implementation for ending transactions. Note that if explicit cache transactions are not used, then transactions do not have to be explicitly ended - for all other cases this method should be overridden with custom commit/rollback logic.
      Specified by:
        `sessionEnd` in interface `CacheStore<K,V>`
      Parameters:
        `commit` - `True` if transaction should commit, `false` for rollback.

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

2020 Copyright © Apache Software Foundation
| Follow @ApacheIgnite
Ignite Database and Caching Platform | : ver. 2.9.0
Release Date | : October 15 2020