We can easily cache data in asp.net using the Caching class provided by asp.net
Here is an example of how to cache data.
if(Cache["data"]==null)
{
Cache.Insert("data", data, null, System.Web.Caching.Cache.NoAbsoluteExpiration, System.Web.Caching.Cache.NoSlidingExpiration);
}
This will cache the "data" until it is removed from the memory.
So how can we know when the cached data is being removed from the memory?
ASP.Net provides a cool feature, that enables us to do it.
There is a delegate to achieve this
System.Web.Caching.CacheItemRemovedCallback
which has the following signature
void RemoveCacheItemHandler(string key, Object value, CacheItemRemovedReason reason);
This delegate can be used to get notification once a particular cached item being removed.
Example of how we can use the delegate:
if(Cache["data"]==null)
{
Cache.Insert("data", data, null, System.Web.Caching.Cache.NoAbsoluteExpiration, System.Web.Caching.Cache.NoSlidingExpiration, RemoveCacheItemHandler);
}
public void RemovedCacheItemHandler(string key, Object value, CacheItemRemovedReason reason)
{
switch (key)
{
case "data":
// cache has been removed; do the process
break;
}
}
Tuesday, June 17, 2008
Tuesday, June 10, 2008
Tracking changes in Microsoft Word Document
In tools select Track Changes.
You can make sure the word is tracking changes by looking for "TRK" in status bar.
You can make sure the word is tracking changes by looking for "TRK" in status bar.
Monday, June 9, 2008
Query String + Special Characters
For sending special characters as Querystring
In javascript we can use the function escape to encode
In .Net we can user Server.URLEncode
To decode the string we can use unescape in javascript
and Server.URLDecode in .Net
Thats all ;p
In javascript we can use the function escape to encode
In .Net we can user Server.URLEncode
To decode the string we can use unescape in javascript
and Server.URLDecode in .Net
Thats all ;p
Subscribe to:
Posts (Atom)