Search code examples
ignite

Ignite expiry policy is not working for old data


I have 400M records on a ignite cache. And native persistence is enabled. I want to enable expiry policy. TO do so i have added below below on my xml config.

        <!-- 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>

It worked for newly added data but i have old 400M data. i need help to remove 30 days old data from this 400M data. How can do this? I have searched but cant find anything. Also i cant purge all data as they are important.


Solution

  • You can't do this for existing data. Ignite doesn't keep track of when an entry was created or modified in any way if expiry policy is not set. You have to iterate over all your data and clean it manually based on the contents (e.g. if you have a creation timestamp attribute).