Alachisoft NCache 4.1 - Online Documentation

Getting notified when an item is updated

Create a class with a name (could be any name) 'CacheEventListner' which implements ' CacheItemUpdatedCallback' from com.alachisoft.ncache.caching:
import com.alachisoft.ncache.web.caching.*;
public class CacheEventListner implements CacheItemUpdatedCallback
public void itemUpdated(String string)
System.out.println("Cache Key" + string + " is Updated");
Subscriber of the event needs to register itself to get notifications. Now simply add an item to get the Notification:
CacheEventListner onItemUpdated = new CacheEventListner();
Cache _cache = NCache.initializeCache("myCache");
CacheItem cItem = new CacheItem("my Item");
_cache.insert("x-y-z", "my Item");
See Also
Copyright © 2005-2012 Alachisoft. All rights reserved.