关于Ignite中的堆缓存-MaxSize,它的真正含义是什么



我对一个参数有点困惑"MaxSize";用于在Ignite中配置堆上缓存。在考虑堆时,我们总是根据内存来考虑大小,但我不确定这里是不是这样。请任何人澄清设置为1000000的maxSize真正意味着什么。上面的评论是100万,也就是说,这对我来说是一个数量,但对我来说没有多大意义。

以下是点火链接-https://ignite.apache.org/docs/latest/configuring-caches/on-heap-caching#configuring-驱逐政策

<bean class="org.apache.ignite.cache.CacheConfiguration">
<property name="name" value="myCache"/>
<!-- Enabling on-heap caching for this distributed cache. -->
<property name="onheapCacheEnabled" value="true"/>
<property name="evictionPolicy">
<!-- LRU eviction policy. -->
<bean class="org.apache.ignite.cache.eviction.lru.LruEvictionPolicy">
<!-- Set the maximum cache size to 1 million (default is 100,000). -->
<property name="maxSize" value="1000000"/>
</bean>
</property>
</bean>

是的,这与缓存中的记录数有关。

这是有道理的,因为您希望只保留最常用的项目用于额外的堆上缓存

您可以使用setMaxMemorySize来限制以字节为单位的缓存大小,正如您所描述的那样。

最新更新