GridGain Developers Hub
GitHub logo GridGain iso GridGain.com
GridGain Software Documentation

On-Heap Caching

GridGain uses an off-heap memory to allocate memory regions outside of Java heap. However, you can enable on-heap caching by setting CacheConfiguration.setOnheapCacheEnabled(true).

On-heap caching is useful in scenarios when you do a lot of cache reads on server nodes that work with cache entries in binary form or invoke cache entries' deserialization. For instance, this might happen when a distributed computation or deployed service gets some data from caches for further processing.

<bean class="org.apache.ignite.configuration.CacheConfiguration">

    <property name="name" value="myCache"/>

    <property name="onheapCacheEnabled" value="true"/>

</bean>
CacheConfiguration cfg = new CacheConfiguration();
cfg.setName("myCache");
cfg.setOnheapCacheEnabled(true);
var cfg = new CacheConfiguration
{
    Name = "myCache",
    OnheapCacheEnabled = true
};

Configuring Eviction Policy

Refer to the On-Heap Cache Eviction section for the instruction on how to configure eviction policy for on-heap caches.