To remove the cache entries based on the cache filters...
1. Coherence QueryMap interface provides keySet with filter
Filter dtfilter = new EqualsFilter("getDate", dt);
Set kset = cache.keySet(dtfilter );
for (Object obj : kset) {
cache.remove(obj);
}
Cache.remove returns the previous value associated with the key. This is not very efficient.
2. Best way to delete the cache entries
Filter dtfilter = new EqualsFilter("getDate", dt);
this.invokeAll(dtfilter , new ConditionalRemove(AlwaysFilter.INSTANCE));
This code is very efficient and it will not return back any old data.
1. Coherence QueryMap interface provides keySet with filter
Filter dtfilter = new EqualsFilter("getDate", dt);
Set kset = cache.keySet(dtfilter );
for (Object obj : kset) {
cache.remove(obj);
}
Cache.remove returns the previous value associated with the key. This is not very efficient.
2. Best way to delete the cache entries
Filter dtfilter = new EqualsFilter("getDate", dt);
this.invokeAll(dtfilter , new ConditionalRemove(AlwaysFilter.INSTANCE));
This code is very efficient and it will not return back any old data.
No comments:
Post a Comment