C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !




How to use Removecallback when cache item is removed from appliaction


Posted Date: 02 Jun 2008    Resource Type: Code Snippets    Category: Caching
Author: NamedmMember Level: Silver    
Rating: Points: 10



To receive notification when a cached item is removed from the cache.we have CacheItemRemovedCallback.


public static void LoadCache(String pKey, Object obj)
{
HttpContext.Current.Cache.Insert(pKey, obj, null, DateTime.Now.AddMinutes(30), Cache.NoSlidingExpiration, CacheItemPriority.Normal, new CacheItemRemovedCallback(RemovedCallback));

}


public static void RemovedCallback(String k, Object v, CacheItemRemovedReason r)
{
HttpContext.Current.Response.Write("Key:"+k+"
");
HttpContext.Current.Response.Write("Object:"+v.ToString()+"
")
HttpContext.Current.Response.Write("Reason:"+r)

}




Responses

Author: chaithanya    11 Jun 2008Member Level: Silver   Points : 1
Nice Post,its really useful for me in learning about Caching.


Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Removecallback  .  

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: SQLcache Dependency and cache API
Previous Resource: How to use Cache in Class files?
Return to Discussion Resource Index
Post New Resource
Category: Caching


Post resources and earn money!
 
Related Resources



dotNet Slackers   BizTalk Adaptors    Web Design


Contact Us    Privacy Policy    Terms Of Use