1 person found this helpful
Yes you can listen for events on a cache - see here Using Map Events - 12c (12.1.2) (this is the current 12.1.2 version but it has not changed from previous versions).
Thanks Jonathan for your timely response will look into the Map event, but just a quick question
Map<Object, Map<Object, Object>> updateUserData = (HashMap) namedCache.get(uniqueKey);
So this is how i retrieve the user data from the NamedCache. What it returns is a Map .....and any change to this current daykey is what the user is worry about.
The addListener() on the ObservableMap will start to listen on any event happening at the all key in the namedCache.I am looking for something like a listener/logic which looks only the for this uniqueKey for this user session.
Will look into the Map Event in detail.
As Jonathan already told you, you can use the Map Events from the Coherence API to accomplish that. The ObservableMap cache implementation makes available different versions (overloaded) of the method addListener(). One of those versions is the public void addMapListener(MapListener listener, Filter filter, boolean fLite);
As you can see in the method signature, you can pass an instance of an Filter object. There are many filter implementations to handle keys filtering, like InFilter, InKeySetFilter and KeyFilter. Pick one that most satisfies your scenario and go ahead!
To listen for changes to a specific key add the listener like this...