Apache Ignite Documentation

GridGain Developer Hub - Apache Ignitetm

Welcome to the Apache Ignite developer hub run by GridGain. Here you'll find comprehensive guides and documentation to help you start working with Apache Ignite as quickly as possible, as well as support if you get stuck.


GridGain also provides Community Edition which is a distribution of Apache Ignite made available by GridGain. It is the fastest and easiest way to get started with Apache Ignite. The Community Edition is generally more stable than the Apache Ignite release available from the Apache Ignite website and may contain extra bug fixes and features that have not made it yet into the release on the Apache website.


Let's jump right in!


Documentation     Ask a Question     Download


Javadoc     Scaladoc     Examples

Near Caches

Create local client-side caches.

Partitioned and replicated caches can also be fronted by a "near cache" which is a smaller local cache that stores the most recently or most frequently accessed data in the on-heap memory. Just like with a partitioned cache, you can control the size of the near cache and its eviction policies.

Near caches can be created directly on client nodes by passing NearCacheConfiguration to the Ignite.createNearCache(NearCacheConfiguration) or Ignite.getOrCreateNearCache(String, NearCacheConfiguration) methods. Use the Ignite.getOrCreateCache(CacheConfiguration, NearCacheConfiguration) method if you need to both start a distributed cache dynamically and create a near cache for it.

// Create near-cache configuration for "myCache".
NearCacheConfiguration<Integer, Integer> nearCfg = 
    new NearCacheConfiguration<>();

// Use LRU eviction policy to automatically evict entries
// from near-cache, whenever it reaches 100_000 in size.
nearCfg.setNearEvictionPolicyFactory(new LruEvictionPolicyFactory<>(100_000));

// Create a distributed cache on server nodes and 
// a near cache on the local node, named "myCache".
IgniteCache<Integer, Integer> cache = ignite.getOrCreateCache(
    new CacheConfiguration<Integer, Integer>("myCache"), nearCfg);
<bean class="org.apache.ignite.configuration.CacheConfiguration">
    <property name="name" value="myCache" />

    <property name="nearConfiguration">
        <bean class="org.apache.ignite.configuration.NearCacheConfiguration">
            <property name="nearEvictionPolicy">
                <bean class="org.apache.ignite.cache.eviction.lru.LruEvictionPolicy">
                    <property name="maxSize" value="100000"/>

Usually, when using Ignite with affinity collocation, near caches should not be used. If computations are collocated with the corresponding partition cache nodes then the near cache is simply not needed because all the data is available locally in the partitioned cache. However, there are cases when it is impossible to send computations to remote nodes. For cases like these, near caches can significantly improve scalability and the overall performance of the application.



Near caches are fully transactional and get updated or invalidated automatically whenever the data changes on the servers.


Near Caches on Server Nodes

When accessing data from PARTITIONED caches on the server side in a non-collocated fashion, you may need to configure near-caches on the server nodes via CacheConfiguration.setNearConfiguration(...) property.


Most configuration parameters available on CacheConfiguration that make sense for the near cache are inherited from the server configuration. For example, if the server cache has an ExpiryPolicy set, entries in the near cache will be expired based on the same policy.

Parameters listed in the table below are not inherited from the server configuration. They are provided separately, via the NearCacheConfiguration object.

Setter Method




Eviction policy for the near cache.



Start size for near cache.


Updated about a year ago

Near Caches

Create local client-side caches.

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.