.NET and ASP.NET interview question – what is the difference between Cache and Application?

Answer:

Application and Cache both help to share global data and cache data
across the users.but cache object is proactive and you can define dependency.In application object you can’t define depenency.

Below is the code for declaring application and cache object.

CacheDependency objCacheDependency = new CacheDependency(Server.MapPath("Banner.txt"));
Cache.Insert("Banner", strBanner, objCacheDependency); Application["Banner"] = "strBanner";

In the above code, for Cache object you can define dependency but in Application object you can’t define dependency.when the banner file is changed the Cache object can be refreshed but the application remain static and holds the old text of banner file.

Please click here to see more .NET/ASP.NET interview questions

Regards,

Visit Authors blog for more ASP.NET interview questions

About these ads

About c# and .NET Interview questions

This blog is for developers who want to crack .NET and C# interviews. It has all tips and tricks needed to crack .NET interviews , C# interview , SQL Server interview , Java interview , WCF Interview , Silverlight interview , WPF interview , LINQ interview , Entity framework Interview.
This entry was posted in Uncategorized and tagged , , , , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s