Class 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 Detail

      • CacheStoreAdapter

        public CacheStoreAdapter()
    • Method Detail

      • 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.