点燃过期政策不适用于旧数据
Ignite expiry policy is not working for old data
我在 ignite 缓存中有 400M 条记录。并启用本机持久性。我想启用过期政策。为此,我在下面添加了我的 xml 配置。
<!-- Enabling expiry policy -->
<property name="cacheConfiguration">
<list>
<bean class="org.apache.ignite.configuration.CacheConfiguration">
<property name="name" value="CACHE_L4_TRIGGER_NOTIFICATION"/>
<property name="expiryPolicyFactory">
<bean class="javax.cache.expiry.CreatedExpiryPolicy" factory-method="factoryOf">
<constructor-arg>
<bean class="javax.cache.expiry.Duration">
<constructor-arg value="MINUTES"/>
<constructor-arg value="60"/>
</bean>
</constructor-arg>
</bean>
</property>
</bean>
</list>
</property>
它适用于新添加的数据,但我有旧的 400M 数据。我需要帮助从这个 400M 数据中删除 30 天前的数据。怎么能做到这一点?我已经搜索过但找不到任何东西。我也不能清除所有数据,因为它们很重要。
您不能对现有数据执行此操作。如果未设置过期策略,Ignite 不会以任何方式跟踪条目何时创建或修改。您必须遍历所有数据并根据内容手动清理它(例如,如果您有创建时间戳属性)。
我在 ignite 缓存中有 400M 条记录。并启用本机持久性。我想启用过期政策。为此,我在下面添加了我的 xml 配置。
<!-- Enabling expiry policy -->
<property name="cacheConfiguration">
<list>
<bean class="org.apache.ignite.configuration.CacheConfiguration">
<property name="name" value="CACHE_L4_TRIGGER_NOTIFICATION"/>
<property name="expiryPolicyFactory">
<bean class="javax.cache.expiry.CreatedExpiryPolicy" factory-method="factoryOf">
<constructor-arg>
<bean class="javax.cache.expiry.Duration">
<constructor-arg value="MINUTES"/>
<constructor-arg value="60"/>
</bean>
</constructor-arg>
</bean>
</property>
</bean>
</list>
</property>
它适用于新添加的数据,但我有旧的 400M 数据。我需要帮助从这个 400M 数据中删除 30 天前的数据。怎么能做到这一点?我已经搜索过但找不到任何东西。我也不能清除所有数据,因为它们很重要。
您不能对现有数据执行此操作。如果未设置过期策略,Ignite 不会以任何方式跟踪条目何时创建或修改。您必须遍历所有数据并根据内容手动清理它(例如,如果您有创建时间戳属性)。