Class GridCacheProxyImpl<K,​V>

    • Constructor Detail

      • GridCacheProxyImpl

        public GridCacheProxyImpl()
        Empty constructor required for Externalizable.
    • Method Detail

      • name

        public String name()
        Gets name of this cache (null for default cache).
        Specified by:
        name in interface IgniteInternalCache<K,​V>
        Returns:
        Cache name.
      • cache

        public <K1,​V1> IgniteInternalCache<K1,​V1> cache()
        Gets base cache for this projection.
        Specified by:
        cache in interface IgniteInternalCache<K,​V>
        Type Parameters:
        K1 - Cache key type.
        V1 - Cache value type.
        Returns:
        Base cache for this projection.
      • affinity

        public Affinity<K> affinity()
        Gets affinity service to provide information about data partitioning and distribution.
        Specified by:
        affinity in interface IgniteInternalCache<K,​V>
        Returns:
        Cache data affinity service.
      • localLoadCache

        public void localLoadCache​(IgniteBiPredicate<K,​V> p,
                                   @Nullable
                                   @Nullable Object[] args)
                            throws IgniteCheckedException
        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 IgniteInternalCache<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.
        Throws:
        IgniteCheckedException - If loading failed.
      • localLoadCacheAsync

        public IgniteInternalFuture<?> localLoadCacheAsync​(IgniteBiPredicate<K,​V> p,
                                                           @Nullable
                                                           @Nullable Object[] args)
        Asynchronously delegates to CacheStore.loadCache(IgniteBiInClosure, Object...) method to reload state from the underlying persistent storage. The reloaded 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 reloaded 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:
        localLoadCacheAsync in interface IgniteInternalCache<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.
        Returns:
        Future to be completed whenever loading completes.
      • setSkipStore

        public GridCacheProxyImpl<K,​V> setSkipStore​(boolean skipStore)
        Specified by:
        setSkipStore in interface IgniteInternalCache<K,​V>
        Parameters:
        skipStore - Skip store flag.
        Returns:
        New internal cache instance based on this one, but with skip store flag enabled.
      • keepBinary

        public <K1,​V1> GridCacheProxyImpl<K1,​V1> keepBinary()
        Creates projection that will operate with binary objects.

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

        • org.gridgain.grid.binary.BinaryObject for binary classes
        • All primitives (byte, int, ...) and there boxed versions (Byte, Integer, ...)
        • Arrays of primitives (byte[], int[], ...)
        • String and array of Strings
        • UUID and array of UUIDs
        • Date and array of Dates
        • Timestamp and array of Timestamps
        • Enums and array of enums
        • Maps, collections and array of objects (but objects inside them will still be converted if they are binary)

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

         IgniteInternalCache prj = cache.keepBinary();
        
         // Value is not deserialized and returned in binary format.
         GridBinaryObject po = prj.get(1);
         

        Note that this method makes sense only if cache is working in binary mode (org.apache.ignite.configuration.CacheConfiguration#isBinaryEnabled() returns true. If not, this method is no-op and will return current projection.

        Specified by:
        keepBinary in interface IgniteInternalCache<K,​V>
        Returns:
        New internal cache instance for binary objects.
      • isEmpty

        public boolean isEmpty()
        Returns true if this map contains no key-value mappings.
        Specified by:
        isEmpty in interface IgniteInternalCache<K,​V>
        Returns:
        true if this map contains no key-value mappings.
      • containsKey

        public boolean containsKey​(K key)
        Specified by:
        containsKey in interface IgniteInternalCache<K,​V>
        Parameters:
        key - Key.
        Returns:
        True if cache contains mapping for a given key.
      • get

        @Nullable
        public V get​(K key)
              throws IgniteCheckedException
        Retrieves value mapped to the specified key from cache. Value will only be returned if its entry passed the optional filter provided. Filter check is atomic, and therefore the returned value is guaranteed to be consistent with the filter. The return value of null means entry did not pass the provided filter or cache has no mapping for the key.

        If the value is not present in cache, then it will be looked up from swap storage. If it's not present in swap, or if swap is disable, and if read-through is allowed, value will be loaded from CacheStore persistent storage via CacheStore#load(Transaction, Object) method.

        Transactions

        This method is transactional and will enlist the entry into ongoing transaction if there is one.
        Specified by:
        get in interface IgniteInternalCache<K,​V>
        Parameters:
        key - Key to retrieve the value for.
        Returns:
        Value for the given key.
        Throws:
        IgniteCheckedException - If get operation failed.
      • getEntry

        @Nullable
        public @Nullable CacheEntry<K,​V> getEntry​(K key)
                                                 throws IgniteCheckedException
        Retrieves value mapped to the specified key from cache. Value will only be returned if its entry passed the optional filter provided. Filter check is atomic, and therefore the returned value is guaranteed to be consistent with the filter. The return value of null means entry did not pass the provided filter or cache has no mapping for the key.

        If the value is not present in cache, then it will be looked up from swap storage. If it's not present in swap, or if swap is disable, and if read-through is allowed, value will be loaded from CacheStore persistent storage via CacheStore#load(Transaction, Object) method.

        Transactions

        This method is transactional and will enlist the entry into ongoing transaction if there is one.
        Specified by:
        getEntry in interface IgniteInternalCache<K,​V>
        Parameters:
        key - Key to retrieve the value for.
        Returns:
        Value for the given key.
        Throws:
        IgniteCheckedException - If get operation failed.
      • getAsync

        public IgniteInternalFuture<V> getAsync​(K key)
        Asynchronously retrieves value mapped to the specified key from cache. Value will only be returned if its entry passed the optional filter provided. Filter check is atomic, and therefore the returned value is guaranteed to be consistent with the filter. The return value of null means entry did not pass the provided filter or cache has no mapping for the key.

        If the value is not present in cache, then it will be looked up from swap storage. If it's not present in swap, or if swap is disabled, and if read-through is allowed, value will be loaded from CacheStore persistent storage via CacheStore#load(Transaction, Object) method.

        Transactions

        This method is transactional and will enlist the entry into ongoing transaction if there is one.
        Specified by:
        getAsync in interface IgniteInternalCache<K,​V>
        Parameters:
        key - Key for the value to get.
        Returns:
        Future for the get operation.
      • getEntryAsync

        public IgniteInternalFuture<CacheEntry<K,​V>> getEntryAsync​(K key)
        Asynchronously retrieves value mapped to the specified key from cache. Value will only be returned if its entry passed the optional filter provided. Filter check is atomic, and therefore the returned value is guaranteed to be consistent with the filter. The return value of null means entry did not pass the provided filter or cache has no mapping for the key.

        If the value is not present in cache, then it will be looked up from swap storage. If it's not present in swap, or if swap is disabled, and if read-through is allowed, value will be loaded from CacheStore persistent storage via CacheStore#load(Transaction, Object) method.

        Transactions

        This method is transactional and will enlist the entry into ongoing transaction if there is one.
        Specified by:
        getEntryAsync in interface IgniteInternalCache<K,​V>
        Parameters:
        key - Key for the value to get.
        Returns:
        Future for the get operation.
      • getForcePrimaryAsync

        public IgniteInternalFuture<V> getForcePrimaryAsync​(K key)
        Asynchronously gets value from cache. Will go to primary node even if this is a backup.
        Specified by:
        getForcePrimaryAsync in interface IgniteInternalCache<K,​V>
        Parameters:
        key - Key to get value for.
        Returns:
        Future with result.
      • getAllOutTx

        @Nullable
        public @Nullable Map<K,​V> getAllOutTx​(Set<? extends K> keys)
                                             throws IgniteCheckedException
        Gets values from cache. Will bypass started transaction, if any, i.e. will not enlist entries and will not lock any keys if pessimistic transaction is started by thread.
        Specified by:
        getAllOutTx in interface IgniteInternalCache<K,​V>
        Parameters:
        keys - Keys to get values for.
        Returns:
        Value.
        Throws:
        IgniteCheckedException - If failed.
      • getAllOutTxAsync

        @Nullable
        public @Nullable IgniteInternalFuture<Map<K,​V>> getAllOutTxAsync​(Set<? extends K> keys)
        Gets values from cache. Will bypass started transaction, if any, i.e. will not enlist entries and will not lock any keys if pessimistic transaction is started by thread.
        Specified by:
        getAllOutTxAsync in interface IgniteInternalCache<K,​V>
        Parameters:
        keys - Keys to get values for.
        Returns:
        Future for getAllOutTx operation.
      • getAll

        public Map<K,​V> getAll​(@Nullable
                                     @Nullable Collection<? extends K> keys)
                              throws IgniteCheckedException
        Retrieves values mapped to the specified keys from cache. Value will only be returned if its entry passed the optional filter provided. Filter check is atomic, and therefore the returned value is guaranteed to be consistent with the filter. If requested key-value pair is not present in the returned map, then it means that its entry did not pass the provided filter or cache has no mapping for the key.

        If some value is not present in cache, then it will be looked up from swap storage. If it's not present in swap, or if swap is disabled, and if read-through is allowed, value will be loaded from CacheStore persistent storage via CacheStore#loadAll(Transaction, Collection, org.apache.ignite.lang.IgniteBiInClosure) method.

        Transactions

        This method is transactional and will enlist the entry into ongoing transaction if there is one.
        Specified by:
        getAll in interface IgniteInternalCache<K,​V>
        Parameters:
        keys - Keys to get.
        Returns:
        Map of key-value pairs.
        Throws:
        IgniteCheckedException - If get operation failed.
      • getEntries

        public Collection<CacheEntry<K,​V>> getEntries​(@Nullable
                                                            @Nullable Collection<? extends K> keys)
                                                     throws IgniteCheckedException
        Retrieves values mapped to the specified keys from cache. Value will only be returned if its entry passed the optional filter provided. Filter check is atomic, and therefore the returned value is guaranteed to be consistent with the filter. If requested key-value pair is not present in the returned map, then it means that its entry did not pass the provided filter or cache has no mapping for the key.

        If some value is not present in cache, then it will be looked up from swap storage. If it's not present in swap, or if swap is disabled, and if read-through is allowed, value will be loaded from CacheStore persistent storage via CacheStore#loadAll(Transaction, Collection, org.apache.ignite.lang.IgniteBiInClosure) method.

        Transactions

        This method is transactional and will enlist the entry into ongoing transaction if there is one.
        Specified by:
        getEntries in interface IgniteInternalCache<K,​V>
        Parameters:
        keys - Keys to get.
        Returns:
        Map of key-value pairs.
        Throws:
        IgniteCheckedException - If get operation failed.
      • getAllAsync

        public IgniteInternalFuture<Map<K,​V>> getAllAsync​(@Nullable
                                                                @Nullable Collection<? extends K> keys)
        Asynchronously retrieves values mapped to the specified keys from cache. Value will only be returned if its entry passed the optional filter provided. Filter check is atomic, and therefore the returned value is guaranteed to be consistent with the filter. If requested key-value pair is not present in the returned map, then it means that its entry did not pass the provided filter or cache has no mapping for the key.

        If some value is not present in cache, then it will be looked up from swap storage. If it's not present in swap, or if swap is disabled, and if read-through is allowed, value will be loaded from CacheStore persistent storage via CacheStore#loadAll(Transaction, Collection, org.apache.ignite.lang.IgniteBiInClosure) method.

        Transactions

        This method is transactional and will enlist the entry into ongoing transaction if there is one.
        Specified by:
        getAllAsync in interface IgniteInternalCache<K,​V>
        Parameters:
        keys - Key for the value to get.
        Returns:
        Future for the get operation.
      • getEntriesAsync

        public IgniteInternalFuture<Collection<CacheEntry<K,​V>>> getEntriesAsync​(@Nullable
                                                                                       @Nullable Collection<? extends K> keys)
        Asynchronously retrieves values mapped to the specified keys from cache. Value will only be returned if its entry passed the optional filter provided. Filter check is atomic, and therefore the returned value is guaranteed to be consistent with the filter. If requested key-value pair is not present in the returned map, then it means that its entry did not pass the provided filter or cache has no mapping for the key.

        If some value is not present in cache, then it will be looked up from swap storage. If it's not present in swap, or if swap is disabled, and if read-through is allowed, value will be loaded from CacheStore persistent storage via CacheStore#loadAll(Transaction, Collection, org.apache.ignite.lang.IgniteBiInClosure) method.

        Transactions

        This method is transactional and will enlist the entry into ongoing transaction if there is one.
        Specified by:
        getEntriesAsync in interface IgniteInternalCache<K,​V>
        Parameters:
        keys - Key for the value to get.
        Returns:
        Future for the get operation.
      • getAndPut

        @Nullable
        public V getAndPut​(K key,
                           V val)
                    throws IgniteCheckedException
        Stores given key-value pair in cache. If filters are provided, then entries will be stored in cache only if they pass the filter. Note that filter check is atomic, so value stored in cache is guaranteed to be consistent with the filters. 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, CacheStore#load(Transaction, Object) method will be used.

        If the returned value is not needed, method #putx(Object, Object, org.apache.ignite.lang.IgnitePredicate[]) 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 CacheStore#put(Transaction, Object, Object) method.

        Transactions

        This method is transactional and will enlist the entry into ongoing transaction if there is one.
        Specified by:
        getAndPut in interface IgniteInternalCache<K,​V>
        Parameters:
        key - Key to store in cache.
        val - Value to be associated with the given key.
        Returns:
        Previous value associated with specified key, or null if entry did not pass the filter, or if there was no mapping for the key in swap or in persistent storage.
        Throws:
        IgniteCheckedException - If put operation failed.
      • getAndPutAsync

        public IgniteInternalFuture<V> getAndPutAsync​(K key,
                                                      V val)
        Asynchronously stores given key-value pair in cache. If filters are provided, then entries will be stored in cache only if they pass the filter. Note that filter check is atomic, so value stored in cache is guaranteed to be consistent with the filters. If cache previously contained value for the given key, then this value is returned. Otherwise, in case of CacheMode.REPLICATED caches, the value will be loaded from swap and, if it's not there, and read-through is allowed, from the underlying CacheStore storage. In case of CacheMode.PARTITIONED 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 and read-through is allowed, from the underlying persistent storage. If value has to be loaded from persistent storage, CacheStore#load(Transaction, Object) method will be used.

        If the returned value is not needed, method #putx(Object, Object, org.apache.ignite.lang.IgnitePredicate[]) 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 CacheStore#put(Transaction, Object, Object) method.

        Transactions

        This method is transactional and will enlist the entry into ongoing transaction if there is one.
        Specified by:
        getAndPutAsync in interface IgniteInternalCache<K,​V>
        Parameters:
        key - Key to store in cache.
        val - Value to be associated with the given key.
        Returns:
        Future for the put operation.
      • put

        public boolean put​(K key,
                           V val)
                    throws IgniteCheckedException
        Stores given key-value pair in cache. If filters are provided, then entries will be stored in cache only if they pass the filter. Note that filter check is atomic, so value stored in cache is guaranteed to be consistent with the filters.

        This method will return true if value is stored in cache and false otherwise. Unlike #put(Object, Object, org.apache.ignite.lang.IgnitePredicate[]) method, it does not return previous value and, therefore, does not have any overhead associated with returning a value. It should be used whenever return value is not required.

        If write-through is enabled, the stored value will be persisted to CacheStore via CacheStore#put(Transaction, Object, Object) method.

        Transactions

        This method is transactional and will enlist the entry into ongoing transaction if there is one.
        Specified by:
        put in interface IgniteInternalCache<K,​V>
        Parameters:
        key - Key to store in cache.
        val - Value to be associated with the given key.
        Returns:
        True if optional filter passed and value was stored in cache, false otherwise. Note that this method will return true if filter is not specified.
        Throws:
        IgniteCheckedException - If put operation failed.
      • invoke

        public <T> javax.cache.processor.EntryProcessorResult<T> invoke​(K key,
                                                                        javax.cache.processor.EntryProcessor<K,​V,​T> entryProcessor,
                                                                        Object... args)
                                                                 throws IgniteCheckedException
        Specified by:
        invoke in interface IgniteInternalCache<K,​V>
        Parameters:
        key - Key.
        entryProcessor - Entry processor.
        args - Arguments.
        Returns:
        Invoke result.
        Throws:
        IgniteCheckedException - If failed.
      • invokeAsync

        public <T> IgniteInternalFuture<javax.cache.processor.EntryProcessorResult<T>> invokeAsync​(K key,
                                                                                                   javax.cache.processor.EntryProcessor<K,​V,​T> entryProcessor,
                                                                                                   Object... args)
        Specified by:
        invokeAsync in interface IgniteInternalCache<K,​V>
        Parameters:
        key - Key.
        entryProcessor - Entry processor.
        args - Arguments.
        Returns:
        Future.
      • invokeAllAsync

        public <T> IgniteInternalFuture<Map<K,​javax.cache.processor.EntryProcessorResult<T>>> invokeAllAsync​(Set<? extends K> keys,
                                                                                                                   javax.cache.processor.EntryProcessor<K,​V,​T> entryProcessor,
                                                                                                                   Object... args)
        Specified by:
        invokeAllAsync in interface IgniteInternalCache<K,​V>
        Parameters:
        keys - Keys.
        entryProcessor - Entry processor.
        args - Arguments.
        Returns:
        Future.
      • 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)
                                                                                 throws IgniteCheckedException
        Specified by:
        invokeAll in interface IgniteInternalCache<K,​V>
        Parameters:
        map - Map containing keys and entry processors to be applied to values.
        args - Arguments.
        Returns:
        Invoke results.
        Throws:
        IgniteCheckedException - If failed.
      • invokeAllAsync

        public <T> IgniteInternalFuture<Map<K,​javax.cache.processor.EntryProcessorResult<T>>> invokeAllAsync​(Map<? extends K,​? extends javax.cache.processor.EntryProcessor<K,​V,​T>> map,
                                                                                                                   Object... args)
        Specified by:
        invokeAllAsync in interface IgniteInternalCache<K,​V>
        Parameters:
        map - Map containing keys and entry processors to be applied to values.
        args - Arguments.
        Returns:
        Future.
      • putAsync

        public IgniteInternalFuture<Boolean> putAsync​(K key,
                                                      V val)
        Stores given key-value pair in cache. If filters are provided, then entries will be stored in cache only if they pass the filter. Note that filter check is atomic, so value stored in cache is guaranteed to be consistent with the filters.

        This method will return true if value is stored in cache and false otherwise. Unlike #put(Object, Object, org.apache.ignite.lang.IgnitePredicate[]) method, it does not return previous value and, therefore, does not have any overhead associated with returning of a value. It should always be used whenever return value is not required.

        If write-through is enabled, the stored value will be persisted to CacheStore via CacheStore#put(Transaction, Object, Object) method.

        Transactions

        This method is transactional and will enlist the entry into ongoing transaction if there is one.
        Specified by:
        putAsync in interface IgniteInternalCache<K,​V>
        Parameters:
        key - Key to store in cache.
        val - Value to be associated with the given key.
        Returns:
        Future for the put operation. Future will return true if optional filter passed and value was stored in cache, false otherwise. Note that future will return true if filter is not specified.
      • getAndPutIfAbsent

        @Nullable
        public V getAndPutIfAbsent​(K key,
                                   V val)
                            throws IgniteCheckedException
        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, CacheStore#load(Transaction, Object) method will be used.

        If the returned value is not needed, method IgniteInternalCache.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 CacheStore#put(Transaction, Object, Object) method.

        Transactions

        This method is transactional and will enlist the entry into ongoing transaction if there is one.
        Specified by:
        getAndPutIfAbsent in interface IgniteInternalCache<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.
        Throws:
        IgniteCheckedException - If put operation failed.
      • getAndPutIfAbsentAsync

        public IgniteInternalFuture<V> getAndPutIfAbsentAsync​(K key,
                                                              V val)
        Asynchronously 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, CacheStore#load(Transaction, Object) method will be used.

        If the returned value is not needed, method IgniteInternalCache.putIfAbsentAsync(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 CacheStore#put(Transaction, Object, Object) method.

        Transactions

        This method is transactional and will enlist the entry into ongoing transaction if there is one.
        Specified by:
        getAndPutIfAbsentAsync in interface IgniteInternalCache<K,​V>
        Parameters:
        key - Key to store in cache.
        val - Value to be associated with the given key.
        Returns:
        Future of put operation which will provide previously contained value regardless of whether put happened or not.
      • putIfAbsent

        public boolean putIfAbsent​(K key,
                                   V val)
                            throws IgniteCheckedException
        Stores given key-value pair in cache only if cache had no previous mapping for it.

        This method will return true if value is stored in cache and false otherwise. Unlike IgniteInternalCache.getAndPutIfAbsent(Object, Object) method, it does not return previous value and, therefore, does not have any overhead associated with returning of a value. It should always be used whenever return value is not required.

        If write-through is enabled, the stored value will be persisted to CacheStore via CacheStore#put(Transaction, Object, Object) method.

        Transactions

        This method is transactional and will enlist the entry into ongoing transaction if there is one.
        Specified by:
        putIfAbsent in interface IgniteInternalCache<K,​V>
        Parameters:
        key - Key to store in cache.
        val - Value to be associated with the given key.
        Returns:
        true if value is stored in cache and false otherwise.
        Throws:
        IgniteCheckedException - If put operation failed.
      • putIfAbsentAsync

        public IgniteInternalFuture<Boolean> putIfAbsentAsync​(K key,
                                                              V val)
        Asynchronously stores given key-value pair in cache only if cache had no previous mapping for it.

        This method will return true if value is stored in cache and false otherwise. Unlike IgniteInternalCache.getAndPutIfAbsent(Object, Object) method, it does not return previous value and, therefore, does not have any overhead associated with returning of a value. It should always be used whenever return value is not required.

        If write-through is enabled, the stored value will be persisted to CacheStore via CacheStore#put(Transaction, Object, Object) method.

        Transactions

        This method is transactional and will enlist the entry into ongoing transaction if there is one.
        Specified by:
        putIfAbsentAsync in interface IgniteInternalCache<K,​V>
        Parameters:
        key - Key to store in cache.
        val - Value to be associated with the given key.
        Returns:
        Future for this put operation.
      • getAndReplace

        @Nullable
        public V getAndReplace​(K key,
                               V val)
                        throws IgniteCheckedException
        Stores given key-value pair in cache only if there is a previous mapping for it. 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, CacheStore#load(Transaction, Object) method will be used.

        If the returned value is not needed, method IgniteInternalCache.replace(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 CacheStore#put(Transaction, Object, Object) method.

        Transactions

        This method is transactional and will enlist the entry into ongoing transaction if there is one.
        Specified by:
        getAndReplace in interface IgniteInternalCache<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 replace happened or not.
        Throws:
        IgniteCheckedException - If replace operation failed.
      • getAndReplaceAsync

        public IgniteInternalFuture<V> getAndReplaceAsync​(K key,
                                                          V val)
        Asynchronously stores given key-value pair in cache only if there is a previous mapping for it. If cache previously contained value for the given key, then this value is returned.In case of CacheMode.PARTITIONED 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, CacheStore#load(Transaction, Object) method will be used.

        If the returned value is not needed, method IgniteInternalCache.replace(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 CacheStore#put(Transaction, Object, Object) method.

        Transactions

        This method is transactional and will enlist the entry into ongoing transaction if there is one.
        Specified by:
        getAndReplaceAsync in interface IgniteInternalCache<K,​V>
        Parameters:
        key - Key to store in cache.
        val - Value to be associated with the given key.
        Returns:
        Future for replace operation.
      • replace

        public boolean replace​(K key,
                               V val)
                        throws IgniteCheckedException
        Stores given key-value pair in cache only if only if there is a previous mapping for it.

        This method will return true if value is stored in cache and false otherwise. Unlike IgniteInternalCache.getAndReplace(Object, Object) method, it does not return previous value and, therefore, does not have any overhead associated with returning of a value. It should always be used whenever return value is not required.

        If write-through is enabled, the stored value will be persisted to CacheStore via CacheStore#put(Transaction, Object, Object) method.

        Transactions

        This method is transactional and will enlist the entry into ongoing transaction if there is one.
        Specified by:
        replace in interface IgniteInternalCache<K,​V>
        Parameters:
        key - Key to store in cache.
        val - Value to be associated with the given key.
        Returns:
        True if replace happened, false otherwise.
        Throws:
        IgniteCheckedException - If replace operation failed.
      • replaceAsync

        public IgniteInternalFuture<Boolean> replaceAsync​(K key,
                                                          V val)
        Asynchronously stores given key-value pair in cache only if only if there is a previous mapping for it.

        This method will return true if value is stored in cache and false otherwise. Unlike IgniteInternalCache.getAndReplaceAsync(Object, Object) method, it does not return previous value and, therefore, does not have any overhead associated with returning of a value. It should always be used whenever return value is not required.

        If write-through is enabled, the stored value will be persisted to CacheStore via CacheStore#put(Transaction, Object, Object) method.

        Transactions

        This method is transactional and will enlist the entry into ongoing transaction if there is one.
        Specified by:
        replaceAsync in interface IgniteInternalCache<K,​V>
        Parameters:
        key - Key to store in cache.
        val - Value to be associated with the given key.
        Returns:
        Future for the replace operation.
      • replace

        public boolean replace​(K key,
                               V oldVal,
                               V newVal)
                        throws IgniteCheckedException
        Stores given key-value pair in cache only if only if the previous value is equal to the 'oldVal' passed in.

        This method will return true if value is stored in cache and false otherwise.

        If write-through is enabled, the stored value will be persisted to CacheStore via CacheStore#put(Transaction, Object, Object) method.

        Transactions

        This method is transactional and will enlist the entry into ongoing transaction if there is one.
        Specified by:
        replace in interface IgniteInternalCache<K,​V>
        Parameters:
        key - Key to store in cache.
        oldVal - Old value to match.
        newVal - Value to be associated with the given key.
        Returns:
        True if replace happened, false otherwise.
        Throws:
        IgniteCheckedException - If replace operation failed.
      • replaceAsync

        public IgniteInternalFuture<Boolean> replaceAsync​(K key,
                                                          V oldVal,
                                                          V newVal)
        Asynchronously stores given key-value pair in cache only if only if the previous value is equal to the 'oldVal' passed in.

        This method will return true if value is stored in cache and false otherwise.

        If write-through is enabled, the stored value will be persisted to CacheStore via CacheStore#put(Transaction, Object, Object) method.

        Transactions

        This method is transactional and will enlist the entry into ongoing transaction if there is one.
        Specified by:
        replaceAsync in interface IgniteInternalCache<K,​V>
        Parameters:
        key - Key to store in cache.
        oldVal - Old value to match.
        newVal - Value to be associated with the given key.
        Returns:
        Future for the replace operation.
      • putAll

        public void putAll​(@Nullable
                           @Nullable Map<? extends K,​? extends V> m)
                    throws IgniteCheckedException
        Stores given key-value pairs in cache. If filters are provided, then entries will be stored in cache only if they pass the filter. Note that filter check is atomic, so value stored in cache is guaranteed to be consistent with the filters.

        If write-through is enabled, the stored values will be persisted to CacheStore via CacheStore#putAll(Transaction, Map) method.

        Transactions

        This method is transactional and will enlist the entry into ongoing transaction if there is one.
        Specified by:
        putAll in interface IgniteInternalCache<K,​V>
        Parameters:
        m - Key-value pairs to store in cache.
        Throws:
        IgniteCheckedException - If put operation failed.
      • putAllAsync

        public IgniteInternalFuture<?> putAllAsync​(@Nullable
                                                   @Nullable Map<? extends K,​? extends V> m)
        Asynchronously stores given key-value pairs in cache. If filters are provided, then entries will be stored in cache only if they pass the filter. Note that filter check is atomic, so value stored in cache is guaranteed to be consistent with the filters.

        If write-through is enabled, the stored values will be persisted to CacheStore via CacheStore#putAll(Transaction, Map) method.

        Transactions

        This method is transactional and will enlist the entry into ongoing transaction if there is one.
        Specified by:
        putAllAsync in interface IgniteInternalCache<K,​V>
        Parameters:
        m - Key-value pairs to store in cache.
        Returns:
        Future for putAll operation.
      • keySet

        public Set<K> keySet()
        Set of keys cached on this node. You can remove elements from this set, but you cannot add elements to this set. All removal operation will be reflected on the cache itself.

        Iterator over this set will not fail if set was concurrently updated by another thread. This means that iterator may or may not return latest keys depending on whether they were added before or after current iterator position.

        NOTE: this operation is not distributed and returns only the keys cached on this node.

        Specified by:
        keySet in interface IgniteInternalCache<K,​V>
        Returns:
        Key set for this cache projection.
      • entrySet

        public Set<javax.cache.Cache.Entry<K,​V>> entrySet()
        Gets set of all entries cached on this node. You can remove elements from this set, but you cannot add elements to this set. All removal operation will be reflected on the cache itself.

        NOTE: this operation is not distributed and returns only the entries cached on this node.

        Specified by:
        entrySet in interface IgniteInternalCache<K,​V>
        Returns:
        Entries that pass through key filter.
      • txStart

        public Transaction txStart​(TransactionConcurrency concurrency,
                                   TransactionIsolation isolation,
                                   long timeout,
                                   int txSize)
        Starts transaction with specified isolation, concurrency, timeout, invalidation flag, and number of participating entries.
        Specified by:
        txStart in interface IgniteInternalCache<K,​V>
        Parameters:
        concurrency - Concurrency.
        isolation - Isolation.
        timeout - Timeout.
        txSize - Number of entries participating in transaction (may be approximate).
        Returns:
        New transaction.
      • tx

        public GridNearTxLocal tx()
        Gets transaction started by this thread or null if this thread does not have a transaction.
        Specified by:
        tx in interface IgniteInternalCache<K,​V>
        Returns:
        Transaction started by this thread or null if this thread does not have a transaction.
      • evict

        public boolean evict​(K key)
        Evicts entry associated with given key from cache. Note, that entry will be evicted only if it's not used (not participating in any locks or transactions).
        Specified by:
        evict in interface IgniteInternalCache<K,​V>
        Parameters:
        key - Key to evict from cache.
        Returns:
        True if entry could be evicted, false otherwise.
      • evictAll

        public void evictAll​(@Nullable
                             @Nullable 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).
        Specified by:
        evictAll in interface IgniteInternalCache<K,​V>
        Parameters:
        keys - Keys to evict.
      • clearLocally

        public void clearLocally​(boolean srv,
                                 boolean near,
                                 boolean readers)
        Clears all entries from this cache only if the entry is not currently locked or participating in a transaction.

        Note that this operation is local as it merely clears entries from local cache. It does not remove entries from remote caches or from underlying persistent storage.

        Specified by:
        clearLocally in interface IgniteInternalCache<K,​V>
        Parameters:
        srv - Whether to clear server cache.
        near - Whether to clear near cache.
        readers - Whether to clear readers.
      • clearLocally

        public boolean clearLocally​(K key)
        Clears an entry from this cache and swap storage only if the entry is not currently locked, and is not participating in a transaction.

        Note that this operation is local as it merely clears an entry from local cache. It does not remove entries from remote caches or from underlying persistent storage.

        Specified by:
        clearLocally in interface IgniteInternalCache<K,​V>
        Parameters:
        key - Key to clearLocally.
        Returns:
        True if entry was successfully cleared from cache, false if entry was in use at the time of this method invocation and could not be cleared.
      • clearLocallyAll

        public void clearLocallyAll​(Set<? extends K> keys,
                                    boolean srv,
                                    boolean near,
                                    boolean readers)
        Clears entries from this cache and swap storage only if the entry is not currently locked, and is not participating in a transaction.

        Note that this operation is local as it merely clears an entry from local cache. It does not remove entries from remote caches or from underlying persistent storage.

        Specified by:
        clearLocallyAll in interface IgniteInternalCache<K,​V>
        Parameters:
        keys - Keys to clearLocally.
        srv - Whether to clear server cache.
        near - Whether to clear near cache.
        readers - Whether to clear readers.
      • clear

        public void clear​(K key)
                   throws IgniteCheckedException
        Clears key on all nodes that store it's data. That is, caches are cleared on remote nodes and local node, as opposed to IgniteInternalCache.clearLocally(Object) method which only clears local node's cache.

        Ignite will make the best attempt to clear caches on all nodes. If some caches could not be cleared, then exception will be thrown.

        Specified by:
        clear in interface IgniteInternalCache<K,​V>
        Parameters:
        key - Key to clear.
        Throws:
        IgniteCheckedException - In case of cache could not be cleared on any of the nodes.
      • getAndRemove

        @Nullable
        public V getAndRemove​(K key)
                       throws IgniteCheckedException
        Removes given key mapping from cache. 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 disk-based swap storage, and consecutively, if it's not in swap, from the underlying persistent storage. If value has to be loaded from persistent storage, CacheStore#load(Transaction, Object) method will be used.

        If the returned value is not needed, method #removex(Object, org.apache.ignite.lang.IgnitePredicate[]) 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 value will be removed from CacheStore via CacheStore#remove(Transaction, Object) method.

        Transactions

        This method is transactional and will enlist the entry into ongoing transaction if there is one.
        Specified by:
        getAndRemove in interface IgniteInternalCache<K,​V>
        Parameters:
        key - Key whose mapping is to be removed from cache.
        Returns:
        Previous value associated with specified key, or null if there was no value for this key.
        Throws:
        IgniteCheckedException - If remove operation failed.
      • getAndRemoveAsync

        public IgniteInternalFuture<V> getAndRemoveAsync​(K key)
        Asynchronously removes given key mapping from cache. 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, CacheStore#load(Transaction, Object) method will be used.

        If the returned value is not needed, method #removex(Object, org.apache.ignite.lang.IgnitePredicate[]) 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 value will be removed from CacheStore via CacheStore#remove(Transaction, Object) method.

        Transactions

        This method is transactional and will enlist the entry into ongoing transaction if there is one.
        Specified by:
        getAndRemoveAsync in interface IgniteInternalCache<K,​V>
        Parameters:
        key - Key whose mapping is to be removed from cache.
        Returns:
        Future for the remove operation.
      • remove

        public boolean remove​(K key)
                       throws IgniteCheckedException
        Removes given key mapping from cache.

        This method will return true if remove did occur, which means that all optionally provided filters have passed and there was something to remove, false otherwise.

        If write-through is enabled, the value will be removed from CacheStore via CacheStore#remove(Transaction, Object) method.

        Transactions

        This method is transactional and will enlist the entry into ongoing transaction if there is one.
        Specified by:
        remove in interface IgniteInternalCache<K,​V>
        Parameters:
        key - Key whose mapping is to be removed from cache.
        Returns:
        True if filter passed validation and entry was removed, false otherwise. Note that if filter is not specified, this method will return true.
        Throws:
        IgniteCheckedException - If remove failed.
      • removeAsync

        public IgniteInternalFuture<Boolean> removeAsync​(K key)
        Asynchronously removes given key mapping from cache.

        This method will return true if remove did occur, which means that all optionally provided filters have passed and there was something to remove, false otherwise.

        If write-through is enabled, the value will be removed from CacheStore via CacheStore#remove(Transaction, Object) method.

        Transactions

        This method is transactional and will enlist the entry into ongoing transaction if there is one.
        Specified by:
        removeAsync in interface IgniteInternalCache<K,​V>
        Parameters:
        key - Key whose mapping is to be removed from cache.
        Returns:
        Future for the remove operation. The future will return true if optional filters passed validation and remove did occur, false otherwise. Note that if filter is not specified, this method will return true.
      • remove

        public boolean remove​(K key,
                              V val)
                       throws IgniteCheckedException
        Removes given key mapping from cache if one exists and value is equal to the passed in value.

        If write-through is enabled, the value will be removed from CacheStore via CacheStore#remove(Transaction, Object) method.

        Transactions

        This method is transactional and will enlist the entry into ongoing transaction if there is one.
        Specified by:
        remove in interface IgniteInternalCache<K,​V>
        Parameters:
        key - Key whose mapping is to be removed from cache.
        val - Value to match against currently cached value.
        Returns:
        True if entry was removed and passed in value matched the cached one, false otherwise.
        Throws:
        IgniteCheckedException - If remove failed.
      • removeAsync

        public IgniteInternalFuture<Boolean> removeAsync​(K key,
                                                         V val)
        Asynchronously removes given key mapping from cache if one exists and value is equal to the passed in value.

        This method will return true if remove did occur, which means that all optionally provided filters have passed and there was something to remove, false otherwise.

        If write-through is enabled, the value will be removed from CacheStore via CacheStore#remove(Transaction, Object) method.

        Transactions

        This method is transactional and will enlist the entry into ongoing transaction if there is one.
        Specified by:
        removeAsync in interface IgniteInternalCache<K,​V>
        Parameters:
        key - Key whose mapping is to be removed from cache.
        val - Value to match against currently cached value.
        Returns:
        Future for the remove operation. The future will return true if currently cached value will match the passed in one.
      • removeAllAsync

        public IgniteInternalFuture<?> removeAllAsync​(@Nullable
                                                      @Nullable Collection<? extends K> keys)
        Asynchronously removes given key mappings from cache for entries.

        If write-through is enabled, the values will be removed from CacheStore via IgniteDataStreamer.

        Transactions

        This method is transactional and will enlist the entry into ongoing transaction if there is one.
        Specified by:
        removeAllAsync in interface IgniteInternalCache<K,​V>
        Parameters:
        keys - Keys whose mappings are to be removed from cache.
        Returns:
        Future for the remove operation. The future will complete whenever remove operation completes.
      • lock

        public boolean lock​(K key,
                            long timeout)
                     throws IgniteCheckedException
        Synchronously acquires lock on a cached object with given key only if the passed in filter (if any) passes. This method together with filter check will be executed as one atomic operation.

        Transactions

        Locks are not transactional and should not be used from within transactions. If you do need explicit locking within transaction, then you should use TransactionConcurrency.PESSIMISTIC concurrency control for transaction which will acquire explicit locks for relevant cache operations.
        Specified by:
        lock in interface IgniteInternalCache<K,​V>
        Parameters:
        key - Key to lock.
        timeout - Timeout in milliseconds to wait for lock to be acquired ('0' for no expiration), -1 for immediate failure if lock cannot be acquired immediately).
        Returns:
        True if all filters passed and lock was acquired, false otherwise.
        Throws:
        IgniteCheckedException - If lock acquisition resulted in error.
      • lockAsync

        public IgniteInternalFuture<Boolean> lockAsync​(K key,
                                                       long timeout)
        Asynchronously acquires lock on a cached object with given key only if the passed in filter (if any) passes. This method together with filter check will be executed as one atomic operation.

        Transactions

        Locks are not transactional and should not be used from within transactions. If you do need explicit locking within transaction, then you should use TransactionConcurrency.PESSIMISTIC concurrency control for transaction which will acquire explicit locks for relevant cache operations.
        Specified by:
        lockAsync in interface IgniteInternalCache<K,​V>
        Parameters:
        key - Key to lock.
        timeout - Timeout in milliseconds to wait for lock to be acquired ('0' for no expiration, -1 for immediate failure if lock cannot be acquired immediately).
        Returns:
        Future for the lock operation. The future will return true whenever all filters pass and locks are acquired before timeout is expired, false otherwise.
      • lockAll

        public boolean lockAll​(@Nullable
                               @Nullable Collection<? extends K> keys,
                               long timeout)
                        throws IgniteCheckedException
        All or nothing synchronous lock for passed in keys. This method together with filter check will be executed as one atomic operation. If at least one filter validation failed, no locks will be acquired.

        Transactions

        Locks are not transactional and should not be used from within transactions. If you do need explicit locking within transaction, then you should use TransactionConcurrency.PESSIMISTIC concurrency control for transaction which will acquire explicit locks for relevant cache operations.
        Specified by:
        lockAll in interface IgniteInternalCache<K,​V>
        Parameters:
        keys - Keys to lock.
        timeout - Timeout in milliseconds to wait for lock to be acquired ('0' for no expiration).
        Returns:
        True if all filters passed and locks were acquired before timeout has expired, false otherwise.
        Throws:
        IgniteCheckedException - If lock acquisition resulted in error.
      • lockAllAsync

        public IgniteInternalFuture<Boolean> lockAllAsync​(@Nullable
                                                          @Nullable Collection<? extends K> keys,
                                                          long timeout)
        All or nothing synchronous lock for passed in keys. This method together with filter check will be executed as one atomic operation. If at least one filter validation failed, no locks will be acquired.

        Transactions

        Locks are not transactional and should not be used from within transactions. If you do need explicit locking within transaction, then you should use TransactionConcurrency.PESSIMISTIC concurrency control for transaction which will acquire explicit locks for relevant cache operations.
        Specified by:
        lockAllAsync in interface IgniteInternalCache<K,​V>
        Parameters:
        keys - Keys to lock.
        timeout - Timeout in milliseconds to wait for lock to be acquired ('0' for no expiration).
        Returns:
        Future for the collection of locks. The future will return true if all filters passed and locks were acquired before timeout has expired, false otherwise.
      • unlock

        public void unlock​(K key)
                    throws IgniteCheckedException
        Unlocks given key only if current thread owns the lock. If optional filter will not pass, then unlock will not happen. If the key being unlocked was never locked by current thread, then this method will do nothing.

        Transactions

        Locks are not transactional and should not be used from within transactions. If you do need explicit locking within transaction, then you should use TransactionConcurrency.PESSIMISTIC concurrency control for transaction which will acquire explicit locks for relevant cache operations.
        Specified by:
        unlock in interface IgniteInternalCache<K,​V>
        Parameters:
        key - Key to unlock.
        Throws:
        IgniteCheckedException - If unlock execution resulted in error.
      • unlockAll

        public void unlockAll​(@Nullable
                              @Nullable Collection<? extends K> keys)
                       throws IgniteCheckedException
        Unlocks given keys only if current thread owns the locks. Only the keys that have been locked by calling thread and pass through the filter (if any) will be unlocked. If none of the key locks is owned by current thread, then this method will do nothing.

        Transactions

        Locks are not transactional and should not be used from within transactions. If you do need explicit locking within transaction, then you should use TransactionConcurrency.PESSIMISTIC concurrency control for transaction which will acquire explicit locks for relevant cache operations.
        Specified by:
        unlockAll in interface IgniteInternalCache<K,​V>
        Parameters:
        keys - Keys to unlock.
        Throws:
        IgniteCheckedException - If unlock execution resulted in error.
      • isLocked

        public boolean isLocked​(K key)
        Checks if any node owns a lock for this key.

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

        Specified by:
        isLocked in interface IgniteInternalCache<K,​V>
        Parameters:
        key - Key to check.
        Returns:
        True if lock is owned by some node.
      • isLockedByThread

        public boolean isLockedByThread​(K key)
        Checks if current thread owns a lock on this key.

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

        Specified by:
        isLockedByThread in interface IgniteInternalCache<K,​V>
        Parameters:
        key - Key to check.
        Returns:
        True if key is locked by current thread.
      • size

        public int size()
        Gets the number of all entries cached on this node. This method will return the count of all cache entries and has O(1) complexity on base IgniteInternalCache. It is essentially the size of cache key set and is semantically identical to {Cache.keySet().size().

        NOTE: this operation is not distributed and returns only the number of entries cached on this node.

        Specified by:
        size in interface IgniteInternalCache<K,​V>
        Returns:
        Size of cache on this node.
      • sizeLong

        public long sizeLong()
        Gets the number of all entries cached on this node as a long value. This method will return the count of all cache entries and has O(1) complexity on base IgniteInternalCache. It is essentially the size of cache key set and is semantically identical to {Cache.keySet().size().

        NOTE: this operation is not distributed and returns only the number of entries cached on this node.

        Specified by:
        sizeLong in interface IgniteInternalCache<K,​V>
        Returns:
        Size of cache on this node.
      • nearSize

        public int nearSize()
        Gets size of near cache key set. This method will return count of all entries in near cache and has O(1) complexity on base cache projection.

        Note that for LOCAL non-distributed caches this method will always return 0

        Specified by:
        nearSize in interface IgniteInternalCache<K,​V>
        Returns:
        Size of near cache key set or 0 if cache is not CacheMode.PARTITIONED.
      • primarySize

        public int primarySize()
        Gets the number of all primary entries cached on this node.

        For CacheMode.PARTITIONED and CacheMode.REPLICATED modes, this method will return number of primary entries cached on this node (excluding any backups). The complexity of this method is O(P), where P is the total number of partitions.

        NOTE: this operation is not distributed and returns only the number of primary entries cached on this node.

        Specified by:
        primarySize in interface IgniteInternalCache<K,​V>
        Returns:
        Number of primary entries in cache.
      • primarySizeLong

        public long primarySizeLong()
        Gets the number of all primary entries cached on this node as a long value.

        For CacheMode.PARTITIONED and CacheMode.REPLICATED modes, this method will return number of primary entries cached on this node (excluding any backups). The complexity of this method is O(P), where P is the total number of partitions.

        NOTE: this operation is not distributed and returns only the number of primary entries cached on this node.

        Specified by:
        primarySizeLong in interface IgniteInternalCache<K,​V>
        Returns:
        Number of primary entries in cache.
      • offHeapEntriesCount

        public long offHeapEntriesCount()
        Gets number of cache entries stored in off-heap memory.
        Specified by:
        offHeapEntriesCount in interface IgniteInternalCache<K,​V>
        Returns:
        Number of cache entries stored in off-heap memory.
      • offHeapAllocatedSize

        public long offHeapAllocatedSize()
        Gets memory size allocated in off-heap.
        Specified by:
        offHeapAllocatedSize in interface IgniteInternalCache<K,​V>
        Returns:
        Allocated memory size.
      • rebalance

        public IgniteInternalFuture<?> rebalance()
        Forces this cache node to re-balance its partitions. This method is usually used when CacheConfiguration.getRebalanceDelay() configuration parameter has non-zero value. When many nodes are started or stopped almost concurrently, it is more efficient to delay rebalancing until the node topology is stable to make sure that no redundant re-partitioning happens.

        In case ofCacheMode.PARTITIONED caches, for better efficiency user should usually make sure that new nodes get placed on the same place of consistent hash ring as the left nodes, and that nodes are restarted before rebalanceDelay expires. To place nodes on the same place in consistent hash ring, use IgniteConfiguration.setConsistentId(Serializable) to make sure that a node maps to the same hash ID if re-started.

        See CacheConfiguration.getRebalanceDelay() for more information on how to configure rebalance re-partition delay.

        Specified by:
        rebalance in interface IgniteInternalCache<K,​V>
        Returns:
        Future that will be completed when rebalancing is finished.
      • expiry

        @Nullable
        public @Nullable javax.cache.expiry.ExpiryPolicy expiry()
        Specified by:
        expiry in interface IgniteInternalCache<K,​V>
        Returns:
        ExpiryPolicy associated with this projection.
      • withExpiryPolicy

        public GridCacheProxyImpl<K,​V> withExpiryPolicy​(javax.cache.expiry.ExpiryPolicy plc)
        Specified by:
        withExpiryPolicy in interface IgniteInternalCache<K,​V>
        Parameters:
        plc - ExpiryPolicy to associate with this projection.
        Returns:
        New projection based on this one, but with the specified expiry policy.