org.apache.ignite.internal.processors.cache

## Class IgniteCacheProxy<K,V>

- java.lang.Object
- - org.apache.ignite.internal.AsyncSupportAdapter<IgniteCache<K,V>>
  - - org.apache.ignite.internal.processors.cache.IgniteCacheProxy<K,V>

All Implemented Interfaces:
  Closeable, Externalizable, Serializable, AutoCloseable, Iterable<javax.cache.Cache.Entry<K,V>>, javax.cache.Cache<K,V>, IgniteCache<K,V>, IgniteAsyncSupport

    public class IgniteCacheProxy<K,V>
    extends AsyncSupportAdapter<IgniteCache<K,V>>
    implements IgniteCache<K,V>, Externalizable

Cache proxy.

See Also:
  Serialized Form

### Nested Class Summary

### Nested classes/interfaces inherited from interface javax.cache.Cache

`javax.cache.Cache.Entry<K,V>`

### Field Summary

### Fields inherited from class org.apache.ignite.internal.AsyncSupportAdapter

`curFut`

### Constructor Summary

Constructors
Constructor and Description
`IgniteCacheProxy()` Empty constructor required for `Externalizable`.
`IgniteCacheProxy(GridCacheContext<K,V> ctx, GridCacheProjectionEx<K,V> delegate, GridCacheProjectionImpl<K,V> prj, boolean async)`

### Method Summary

Methods
`void` `clear()`
`void` `close()`
`boolean` `containsKey(K key)`
`boolean` `containsKeys(Set<? extends K> keys)`
`GridCacheContext<K,V>` `context()`
`protected IgniteCache<K,V>` `createAsyncInstance()` Creates component with asynchronous mode enabled.
`void` `deregisterCacheEntryListener(javax.cache.configuration.CacheEntryListenerConfiguration<K,V> lsnrCfg)`
`Set<javax.cache.Cache.Entry<K,V>>` `entrySetx(IgnitePredicate<javax.cache.Cache.Entry<K,V>>... filter)` Gets entry set containing internal entries.
`IgniteCache<K,V>` `flagOn(CacheFlag flag)`
`V` `get(K key)`
`Map<K,V>` `getAll(Collection<? extends K> keys)`
`Map<K,V>` `getAll(Set<? extends K> keys)`
`V` `getAndPut(K key, V val)`
`V` `getAndPutIfAbsent(K key, V val)` Stores given key-value pair in cache only if cache had no previous mapping for it.
`V` `getAndRemove(K key)`
`V` `getAndReplace(K key, V val)`
`javax.cache.CacheManager` `getCacheManager()`
`<C extends javax.cache.configuration.Configuration<K,V>> C` `getConfiguration(Class<C> clazz)`
`String` `getName()`
`<T> T` `invoke(K key, javax.cache.processor.EntryProcessor<K,V,T> entryProcessor, Object... args)`
`<T> Map<K,javax.cache.processor.EntryProcessorResult<T>>` `invokeAll(Map<? extends K,? extends javax.cache.processor.EntryProcessor<K,V,T>> map, Object... args)`
`<T> Map<K,javax.cache.processor.EntryProcessorResult<T>>` `invokeAll(Set<? extends K> keys, javax.cache.processor.EntryProcessor<K,V,T> entryProcessor, Object... args)`
`boolean` `isClosed()`
`boolean` `isLocalLocked(K key, boolean byCurrThread)` Checks if specified key is locked.
`Iterator<javax.cache.Cache.Entry<K,V>>` `iterator()`
`<K1,V1> IgniteCache<K1,V1>` `keepPortable()` Creates projection that will operate with portable objects.
`void` `loadAll(Set<? extends K> keys, boolean replaceExisting, javax.cache.integration.CompletionListener completionLsnr)`
`void` `loadCache(IgniteBiPredicate<K,V> p, Object... args)` Executes `IgniteCache.localLoadCache(IgniteBiPredicate, Object...)` on all cache nodes.
`Iterable<javax.cache.Cache.Entry<K,V>>` `localEntries(CachePeekMode... peekModes)`
`void` `localEvict(Collection<? extends K> keys)` Attempts to evict all entries associated with keys.
`void` `localLoadCache(IgniteBiPredicate<K,V> p, Object... args)` Delegates to `CacheStore.loadCache(IgniteBiInClosure,Object...)` method to load state from the underlying persistent storage.
`V` `localPeek(K key, CachePeekMode... peekModes)` Peeks at in-memory cached value using default `GridCachePeekMode.SMART` peek mode.
`void` `localPromote(Set<? extends K> keys)` This method unswaps cache entries by given keys, if any, from swap storage into memory.
`QueryCursor<javax.cache.Cache.Entry<K,V>>` `localQuery(Query qry)` Queries cache locally.
`QueryCursor<List<?>>` `localQueryFields(SqlFieldsQuery qry)` Queries separate entry fields locally.
`int` `localSize(CachePeekMode... peekModes)` Gets the number of all entries cached on this nodes.
`Lock` `lock(K key)` Creates a `Lock` instance associated with passed key.
`Lock` `lockAll(Collection<? extends K> keys)` Creates a `Lock` instance associated with passed keys.
`CacheMetrics` `metrics()` Gets snapshot metrics (statistics) for this cache.
`CacheMetricsMXBean` `mxBean()` Gets MxBean for this cache.
`void` `put(K key, V val)`
`void` `putAll(Map<? extends K,? extends V> map)`
`boolean` `putIfAbsent(K key, V val)`
`QueryCursor<javax.cache.Cache.Entry<K,V>>` `query(Query qry)` Queries cache.
`QueryCursor<List<?>>` `queryFields(SqlFieldsQuery qry)` Queries separate entry fields.
`javax.cache.Cache.Entry<K,V>` `randomEntry()` Gets a random entry out of cache.
`void` `readExternal(ObjectInput in)`
`void` `registerCacheEntryListener(javax.cache.configuration.CacheEntryListenerConfiguration<K,V> lsnrCfg)`
`boolean` `remove(K key)`
`boolean` `remove(K key, V oldVal)`
`void` `removeAll()`
`void` `removeAll(Set<? extends K> keys)`
`boolean` `replace(K key, V val)`
`boolean` `replace(K key, V oldVal, V newVal)`
`int` `size(CachePeekMode... peekModes)` Gets the number of all entries cached across all nodes.
`String` `toString()`
`<T> T` `unwrap(Class<T> clazz)`
`IgniteCache<K,V>` `withExpiryPolicy(javax.cache.expiry.ExpiryPolicy plc)`
`IgniteCache<K,V>` `withSkipStore()`
`void` `writeExternal(ObjectOutput out)`

### Methods inherited from class org.apache.ignite.internal.AsyncSupportAdapter

`createFuture, future, isAsync, saveOrGet, withAsync`

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

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

### Methods inherited from interface org.apache.ignite.IgniteCache

`withAsync`

### Methods inherited from interface org.apache.ignite.lang.IgniteAsyncSupport

`future, isAsync`

### Constructor Detail

#### IgniteCacheProxy

    public IgniteCacheProxy()

Empty constructor required for `Externalizable`.

#### IgniteCacheProxy

    public IgniteCacheProxy(GridCacheContext<K,V> ctx,
                    GridCacheProjectionEx<K,V> delegate,
                    @Nullable
                    GridCacheProjectionImpl<K,V> prj,
                    boolean async)

Parameters:
  `ctx` - Context.
  `delegate` - Delegate.
  `prj` - Projection.
  `async` - Async support flag.

### Method Detail

#### context

    public GridCacheContext<K,V> context()

Returns:
  Context.

#### metrics

    public CacheMetrics metrics()

Gets snapshot metrics (statistics) for this cache.

Specified by:
  `metrics` in interface `IgniteCache<K,V>`
Returns:
  Cache metrics.

#### mxBean

    public CacheMetricsMXBean mxBean()

Gets MxBean for this cache.

Specified by:
  `mxBean` in interface `IgniteCache<K,V>`
Returns:
  MxBean.

#### getConfiguration

    public <C extends javax.cache.configuration.Configuration<K,V>> C getConfiguration(Class<C> clazz)

Specified by:
  `getConfiguration` in interface `javax.cache.Cache<K,V>`
Specified by:
  `getConfiguration` in interface `IgniteCache<K,V>`

#### randomEntry

    @Nullable
    public javax.cache.Cache.Entry<K,V> randomEntry()

Gets a random entry out of cache. In the worst cache scenario this method has complexity of

    O(S * N/64)

where `N` is the size of internal hash table and `S` is the number of hash table buckets to sample, which is `5` by default. However, if the table is pretty dense, with density factor of `N/64`, which is true for near fully populated caches, this method will generally perform significantly faster with complexity of O(S) where `S = 5`.

Specified by:
  `randomEntry` in interface `IgniteCache<K,V>`
Returns:
  Random entry, or `null` if cache is empty.

#### withExpiryPolicy

    public IgniteCache<K,V> withExpiryPolicy(javax.cache.expiry.ExpiryPolicy plc)

Specified by:
  `withExpiryPolicy` in interface `IgniteCache<K,V>`

#### withSkipStore

    public IgniteCache<K,V> withSkipStore()

Specified by:
  `withSkipStore` in interface `IgniteCache<K,V>`
Returns:
  Cache with read-through write-through behavior disabled.

#### loadCache

    public void loadCache(@Nullable
                 IgniteBiPredicate<K,V> p,
                 @Nullable
                 Object... args)

Executes `IgniteCache.localLoadCache(IgniteBiPredicate, Object...)` on all cache nodes.

Specified by:
  `loadCache` in interface `IgniteCache<K,V>`
Parameters:
  `p` - Optional predicate (may be `null`). If provided, will be used to filter values to be put into cache.
  `args` - Optional user arguments to be passed into `CacheStore.loadCache(IgniteBiInClosure, Object...)` method.

#### localLoadCache

    public void localLoadCache(@Nullable
                      IgniteBiPredicate<K,V> p,
                      @Nullable
                      Object... args)

Delegates to `CacheStore.loadCache(IgniteBiInClosure,Object...)` method to load state from the underlying persistent storage. The loaded values will then be given to the optionally passed in predicate, and, if the predicate returns `true`, will be stored in cache. If predicate is `null`, then all loaded values will be stored in cache.

Note that this method does not receive keys as a parameter, so it is up to `CacheStore` implementation to provide all the data to be loaded.

This method is not transactional and may end up loading a stale value into cache if another thread has updated the value immediately after it has been loaded. It is mostly useful when pre-loading the cache from underlying data store before start, or for read-only caches.

Specified by:
  `localLoadCache` in interface `IgniteCache<K,V>`
Parameters:
  `p` - Optional predicate (may be `null`). If provided, will be used to filter values to be put into cache.
  `args` - Optional user arguments to be passed into `CacheStore.loadCache(IgniteBiInClosure, Object...)` method.

#### getAndPutIfAbsent

    @Nullable
    public V getAndPutIfAbsent(K key,
                               V val)
                        throws javax.cache.CacheException

Stores given key-value pair in cache only if cache had no previous mapping for it. If cache previously contained value for the given key, then this value is returned. In case of `CacheMode.PARTITIONED` or `CacheMode.REPLICATED` caches, the value will be loaded from the primary node, which in its turn may load the value from the swap storage, and consecutively, if it's not in swap, from the underlying persistent storage. If value has to be loaded from persistent storage, `CacheLoader.load(Object)` method will be used.

If the returned value is not needed, method `IgniteCache.putIfAbsent(Object, Object)` should always be used instead of this one to avoid the overhead associated with returning of the previous value.

If write-through is enabled, the stored value will be persisted to `CacheStore` via `CacheWriter.write(Cache.Entry)` method.

## Transactions

This method is transactional and will enlist the entry into ongoing transaction if there is one.

## Cache Flags

This method is not available if any of the following flags are set on projection: `CacheFlag.LOCAL`, `CacheFlag.READ`.

Specified by:
  `getAndPutIfAbsent` in interface `IgniteCache<K,V>`
Parameters:
  `key` - Key to store in cache.
  `val` - Value to be associated with the given key.
Returns:
  Previously contained value regardless of whether put happened or not (`null` if there was no previous value).
Throws:
  `javax.cache.CacheException` - If put operation failed.

#### lock

    public Lock lock(K key)
              throws javax.cache.CacheException

Creates a `Lock` instance associated with passed key. This method does not acquire lock immediately, you have to call appropriate method on returned instance. Returned lock does not support `Lock.newCondition()` method, other methods defined in `Lock` are supported.

Specified by:
  `lock` in interface `IgniteCache<K,V>`
Parameters:
  `key` - Key for lock.
Returns:
  New lock instance associated with passed key.
Throws:
  `javax.cache.CacheException`
See Also:
  `Lock.lock()`, `Lock.tryLock(long, TimeUnit)`

#### lockAll

    public Lock lockAll(Collection<? extends K> keys)

Creates a `Lock` instance associated with passed keys. This method does not acquire lock immediately, you have to call appropriate method on returned instance. Returned lock does not support `Lock.newCondition()` method, other methods defined in `Lock` are supported.

Specified by:
  `lockAll` in interface `IgniteCache<K,V>`
Parameters:
  `keys` - Keys for lock.
Returns:
  New lock instance associated with passed key.
See Also:
  `Lock.lock()`, `Lock.tryLock(long, TimeUnit)`

#### isLocalLocked

    public boolean isLocalLocked(K key,
                        boolean byCurrThread)

Checks if specified key is locked.

This is a local in-VM operation and does not involve any network trips or access to persistent storage in any way.

Specified by:
  `isLocalLocked` in interface `IgniteCache<K,V>`
Parameters:
  `key` - Key to check.
  `byCurrThread` - If `true` method will check that current thread owns a lock on this key, other vise will check that any thread on any node owns a lock on this key.
Returns:
  `True` if lock is owned by some node.

#### query

    public QueryCursor<javax.cache.Cache.Entry<K,V>> query(Query qry)

Queries cache. Accepts any subclass of `Query`.

Specified by:
  `query` in interface `IgniteCache<K,V>`
Parameters:
  `qry` - Query.
Returns:
  Cursor.
See Also:
  `ScanQuery`, `SqlQuery`, `TextQuery`, `SpiQuery`

#### queryFields

    public QueryCursor<List<?>> queryFields(SqlFieldsQuery qry)

Queries separate entry fields.

Specified by:
  `queryFields` in interface `IgniteCache<K,V>`
Parameters:
  `qry` - SQL Query.
Returns:
  Cursor.

#### localQuery

    public QueryCursor<javax.cache.Cache.Entry<K,V>> localQuery(Query qry)

Queries cache locally. Accepts any subclass of `Query`.

Specified by:
  `localQuery` in interface `IgniteCache<K,V>`
Parameters:
  `qry` - Query.
Returns:
  Cursor.
See Also:
  `ScanQuery`, `SqlQuery`, `TextQuery`, `SpiQuery`

#### localQueryFields

    public QueryCursor<List<?>> localQueryFields(SqlFieldsQuery qry)

Queries separate entry fields locally.

Specified by:
  `localQueryFields` in interface `IgniteCache<K,V>`
Parameters:
  `qry` - SQL Query.
Returns:
  Cursor.

#### localEntries

    public Iterable<javax.cache.Cache.Entry<K,V>> localEntries(CachePeekMode... peekModes)
                                                        throws javax.cache.CacheException

Specified by:
  `localEntries` in interface `IgniteCache<K,V>`
Throws:
  `javax.cache.CacheException`

#### localEvict

    public void localEvict(Collection<? extends K> keys)

Attempts to evict all entries associated with keys. Note, that entry will be evicted only if it's not used (not participating in any locks or transactions).

If `CacheConfiguration.isSwapEnabled()` is set to `true` and `CacheFlag.SKIP_SWAP` is not enabled, the evicted entry will be swapped to offheap, and then to disk.

## Cache Flags

This method is not available if any of the following flags are set on projection: `CacheFlag.READ`.

Specified by:
  `localEvict` in interface `IgniteCache<K,V>`
Parameters:
  `keys` - Keys to evict.

#### localPeek

    @Nullable
    public V localPeek(K key,
                       CachePeekMode... peekModes)

Peeks at in-memory cached value using default `GridCachePeekMode.SMART` peek mode.

This method will not load value from any persistent store or from a remote node.

## Transactions

This method does not participate in any transactions, however, it will peek at transactional value according to the `GridCachePeekMode.SMART` mode semantics.

Specified by:
  `localPeek` in interface `IgniteCache<K,V>`
Parameters:
  `key` - Entry key.
Returns:
  Peeked value, or `null` if not found.

#### localPromote

    public void localPromote(Set<? extends K> keys)
                      throws javax.cache.CacheException

This method unswaps cache entries by given keys, if any, from swap storage into memory.

## Transactions

This method is not transactional.

## Cache Flags

This method is not available if any of the following flags are set on projection: `CacheFlag.SKIP_SWAP`, `CacheFlag.READ`.

Specified by:
  `localPromote` in interface `IgniteCache<K,V>`
Parameters:
  `keys` - Keys to promote entries for.
Throws:
  `javax.cache.CacheException` - If promote failed.

#### size

    public int size(CachePeekMode... peekModes)
             throws javax.cache.CacheException

Gets the number of all entries cached across all nodes.

NOTE: this operation is distributed and will query all participating nodes for their cache sizes.

Specified by:
  `size` in interface `IgniteCache<K,V>`
Parameters:
  `peekModes` - Optional peek modes. If not provided, then total cache size is returned.
Returns:
  Cache size across all nodes.
Throws:
  `javax.cache.CacheException`

#### localSize

    public int localSize(CachePeekMode... peekModes)

Gets the number of all entries cached on this nodes.

Specified by:
  `localSize` in interface `IgniteCache<K,V>`
Parameters:
  `peekModes` - Optional peek modes. If not provided, then total cache size is returned.
Returns:
  Cache size on this node.

#### get

    public V get(K key)

Specified by:
  `get` in interface `javax.cache.Cache<K,V>`
Specified by:
  `get` in interface `IgniteCache<K,V>`

#### getAll

    public Map<K,V> getAll(Set<? extends K> keys)

Specified by:
  `getAll` in interface `javax.cache.Cache<K,V>`
Specified by:
  `getAll` in interface `IgniteCache<K,V>`

#### getAll

    public Map<K,V> getAll(Collection<? extends K> keys)

Parameters:
  `keys` - Keys.
Returns:
  Values map.

#### entrySetx

    public Set<javax.cache.Cache.Entry<K,V>> entrySetx(IgnitePredicate<javax.cache.Cache.Entry<K,V>>... filter)

Gets entry set containing internal entries.

Parameters:
  `filter` - Filter.
Returns:
  Entry set.

#### containsKey

    public boolean containsKey(K key)

Specified by:
  `containsKey` in interface `javax.cache.Cache<K,V>`
Specified by:
  `containsKey` in interface `IgniteCache<K,V>`

#### containsKeys

    public boolean containsKeys(Set<? extends K> keys)

Specified by:
  `containsKeys` in interface `IgniteCache<K,V>`

#### loadAll

    public void loadAll(Set<? extends K> keys,
               boolean replaceExisting,
               @Nullable
               javax.cache.integration.CompletionListener completionLsnr)

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

#### put

    public void put(K key,
           V val)

Specified by:
  `put` in interface `javax.cache.Cache<K,V>`
Specified by:
  `put` in interface `IgniteCache<K,V>`

#### getAndPut

    public V getAndPut(K key,
              V val)

Specified by:
  `getAndPut` in interface `javax.cache.Cache<K,V>`
Specified by:
  `getAndPut` in interface `IgniteCache<K,V>`

#### putAll

    public void putAll(Map<? extends K,? extends V> map)

Specified by:
  `putAll` in interface `javax.cache.Cache<K,V>`
Specified by:
  `putAll` in interface `IgniteCache<K,V>`

#### putIfAbsent

    public boolean putIfAbsent(K key,
                      V val)

Specified by:
  `putIfAbsent` in interface `javax.cache.Cache<K,V>`
Specified by:
  `putIfAbsent` in interface `IgniteCache<K,V>`

#### remove

    public boolean remove(K key)

Specified by:
  `remove` in interface `javax.cache.Cache<K,V>`
Specified by:
  `remove` in interface `IgniteCache<K,V>`

#### remove

    public boolean remove(K key,
                 V oldVal)

Specified by:
  `remove` in interface `javax.cache.Cache<K,V>`
Specified by:
  `remove` in interface `IgniteCache<K,V>`

#### getAndRemove

    public V getAndRemove(K key)

Specified by:
  `getAndRemove` in interface `javax.cache.Cache<K,V>`
Specified by:
  `getAndRemove` in interface `IgniteCache<K,V>`

#### replace

    public boolean replace(K key,
                  V oldVal,
                  V newVal)

Specified by:
  `replace` in interface `javax.cache.Cache<K,V>`
Specified by:
  `replace` in interface `IgniteCache<K,V>`

#### replace

    public boolean replace(K key,
                  V val)

Specified by:
  `replace` in interface `javax.cache.Cache<K,V>`
Specified by:
  `replace` in interface `IgniteCache<K,V>`

#### getAndReplace

    public V getAndReplace(K key,
                  V val)

Specified by:
  `getAndReplace` in interface `javax.cache.Cache<K,V>`
Specified by:
  `getAndReplace` in interface `IgniteCache<K,V>`

#### removeAll

    public void removeAll(Set<? extends K> keys)

Specified by:
  `removeAll` in interface `javax.cache.Cache<K,V>`
Specified by:
  `removeAll` in interface `IgniteCache<K,V>`

#### removeAll

    public void removeAll()

Specified by:
  `removeAll` in interface `javax.cache.Cache<K,V>`
Specified by:
  `removeAll` in interface `IgniteCache<K,V>`

#### clear

    public void clear()

Specified by:
  `clear` in interface `javax.cache.Cache<K,V>`
Specified by:
  `clear` in interface `IgniteCache<K,V>`

#### invoke

    public <T> T invoke(K key,
               javax.cache.processor.EntryProcessor<K,V,T> entryProcessor,
               Object... args)
             throws javax.cache.processor.EntryProcessorException

Specified by:
  `invoke` in interface `javax.cache.Cache<K,V>`
Specified by:
  `invoke` in interface `IgniteCache<K,V>`
Throws:
  `javax.cache.processor.EntryProcessorException`

#### invokeAll

    public <T> Map<K,javax.cache.processor.EntryProcessorResult<T>> invokeAll(Set<? extends K> keys,
                                                                     javax.cache.processor.EntryProcessor<K,V,T> entryProcessor,
                                                                     Object... args)

Specified by:
  `invokeAll` in interface `javax.cache.Cache<K,V>`
Specified by:
  `invokeAll` in interface `IgniteCache<K,V>`

#### invokeAll

    public <T> Map<K,javax.cache.processor.EntryProcessorResult<T>> invokeAll(Map<? extends K,? extends javax.cache.processor.EntryProcessor<K,V,T>> map,
                                                                     Object... args)

Specified by:
  `invokeAll` in interface `IgniteCache<K,V>`
Parameters:
  `map` - Map containing keys and entry processors to be applied to values.
  `args` - Additional arguments to pass to the `EntryProcessor`.
Returns:
  The map of `EntryProcessorResult`s of the processing per key, if any, defined by the `EntryProcessor` implementation. No mappings will be returned for `EntryProcessor`s that return a `null` value for a key.

#### getName

    public String getName()

Specified by:
  `getName` in interface `javax.cache.Cache<K,V>`

#### getCacheManager

    public javax.cache.CacheManager getCacheManager()

Specified by:
  `getCacheManager` in interface `javax.cache.Cache<K,V>`

#### close

    public void close()

Specified by:
  `close` in interface `Closeable`
Specified by:
  `close` in interface `AutoCloseable`
Specified by:
  `close` in interface `javax.cache.Cache<K,V>`

#### isClosed

    public boolean isClosed()

Specified by:
  `isClosed` in interface `javax.cache.Cache<K,V>`

#### unwrap

    public <T> T unwrap(Class<T> clazz)

Specified by:
  `unwrap` in interface `javax.cache.Cache<K,V>`

#### registerCacheEntryListener

    public void registerCacheEntryListener(javax.cache.configuration.CacheEntryListenerConfiguration<K,V> lsnrCfg)

Specified by:
  `registerCacheEntryListener` in interface `javax.cache.Cache<K,V>`

#### deregisterCacheEntryListener

    public void deregisterCacheEntryListener(javax.cache.configuration.CacheEntryListenerConfiguration<K,V> lsnrCfg)

Specified by:
  `deregisterCacheEntryListener` in interface `javax.cache.Cache<K,V>`

#### iterator

    public Iterator<javax.cache.Cache.Entry<K,V>> iterator()

Specified by:
  `iterator` in interface `Iterable<javax.cache.Cache.Entry<K,V>>`
Specified by:
  `iterator` in interface `javax.cache.Cache<K,V>`

#### createAsyncInstance

    protected IgniteCache<K,V> createAsyncInstance()

Creates component with asynchronous mode enabled.

Overrides:
  `createAsyncInstance` in class `AsyncSupportAdapter<IgniteCache<K,V>>`
Returns:
  Component with asynchronous mode enabled.

#### keepPortable

    public <K1,V1> IgniteCache<K1,V1> keepPortable()

Creates projection that will operate with portable objects.

Projection returned by this method will force cache not to deserialize portable objects, so keys and values will be returned from cache API methods without changes. Therefore, signature of the projection can contain only following types:

- `PortableObject` for portable classes
- All primitives (byte, int, ...) and there boxed versions (Byte, Integer, ...)
- Arrays of primitives (byte[], int[], ...)
- `String` and array of `String`s
- `UUID` and array of `UUID`s
- `Date` and array of `Date`s
- `Timestamp` and array of `Timestamp`s
- Enums and array of enums
- Maps, collections and array of objects (but objects inside them will still be converted if they are portable)

For example, if you use `Integer` as a key and `Value` class as a value (which will be stored in portable format), you should acquire following projection to avoid deserialization:

     CacheProjection<Integer, GridPortableObject> prj = cache.keepPortable();

     // Value is not deserialized and returned in portable format.
     GridPortableObject po = prj.get(1);

Note that this method makes sense only if cache is working in portable mode (`CacheConfiguration#isPortableEnabled()` returns `true`. If not, this method is no-op and will return current projection.

Returns:
  Projection for portable objects.

#### flagOn

    public IgniteCache<K,V> flagOn(CacheFlag flag)

Parameters:
  `flag` - Flag to turn on.
Returns:
  Cache with given flags enabled.

#### writeExternal

    public void writeExternal(ObjectOutput out)
                       throws IOException

Specified by:
  `writeExternal` in interface `Externalizable`
Throws:
  `IOException`

#### readExternal

    public void readExternal(ObjectInput in)
                      throws IOException,
                             ClassNotFoundException

Specified by:
  `readExternal` in interface `Externalizable`
Throws:
  `IOException`
  `ClassNotFoundException`

#### toString

    public String toString()

Overrides:
  `toString` in class `Object`

2015 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 1.0.0-RC1
Release Date | : February 17 2015