This content has been marked as final.
Show 2 replies
-
1. Re: How to delete all entries whose values satisfy certain condition
galder.zamarreno Jan 30, 2018 2:38 AM (in response to alon3392)Distributed streams could be used for that. Of the top of my head, use filter(Predicate) and then forEach() to delete each of the elements matching. There might be other ways... william.burns ?
-
2. Re: How to delete all entries whose values satisfy certain condition
william.burns Jan 30, 2018 8:52 AM (in response to galder.zamarreno)Yeah actually that is precisely what you can do. I discussed this a while back at [1]. Since then there have been some improvements.
Taking the same example as in [1] you can now do
cache.keySet().stream() .filter(k -> k > 10) .forEach((c, k) -> c.remove(k));
This is due to adding [2] method that allows for the Cache to provided as an argument to the lambda. We also provide for a way to inject the Cache to a Consumer by also implementing [3] (for cases when you can't use the Cache API), but [2] is the recommended method.
[1] What is the recommended approach to iterate and remove entries in Infinispan 8.0.1?