You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by techbysample <tu...@netmille.com> on 2016/03/16 14:05:46 UTC
How to implement a custom ExpiryPolicy based on Entity attributes
Support,
I would like to implement a custom ExpiryPolicy that based on entity (ie:
Employee object)
attributes and time.
For example, if Employee objects are added to the cache, I want Employee
objects
removed where Employee.has401k=false after 5 seconds;
Example:
Employee {
private boolean has401k;
:
:
}
Is this possible? Please advise.
Thanks in advance!
--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/How-to-implement-a-custom-ExpiryPolicy-based-on-Entity-attributes-tp3537.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.
Re: How to implement a custom ExpiryPolicy based on Entity
attributes
Posted by techbysample <tu...@netmille.com>.
Yes.
Thank you!
--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/How-to-implement-a-custom-ExpiryPolicy-based-on-Entity-attributes-tp3537p3560.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.
Re: How to implement a custom ExpiryPolicy based on Entity
attributes
Posted by vkulichenko <va...@gmail.com>.
Hi,
You can define the expiry policy for a particular update when doing a put:
if (!employee.has401k)
cache.withExpiryPolicy(new CreatedExpiryPolicy(new
Duration(TimeUnit.SECONDS, 5))).put(key, employee);
else
cache.put(key, employee);
Will this work for you?
-Val
--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/How-to-implement-a-custom-ExpiryPolicy-based-on-Entity-attributes-tp3537p3545.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.