I’m currently working on a distributed application that requires cluster wide caching support for its operation. Since ASP.NET Cache does not work in clustered environment, I was thinking to code my own custom caching solution and confronted some issues. As we all know that a unique instance of Cache runs in Application scope on each AppDomain, so a problem in providing synchronization is how to add/change a Cache item that is added/changed in one of the domains. Also, how to remove/expire a Cache item that has been removed/expired in one of the AppDomains. Please advise…

I have come across a useful product for distributed caching known as NCache from alachisoft.com. Its a caching solution that provides high performance and scalability, specifically targeted for .NET based Applications. The product allows transparent saving and retrieval of ASP.NET session-state objects within a webfarm. It incorporates replicated caching and avoids single point of failure.

May be this product helps you.

The Microsoft .NET Framework version 2.0 includes significant enhancements to ASP.NET in virtually all areas including Caching. Features such as configurable caching and SQL cache invalidation allow you to optimize the performance of your applications greatly.
With the introduction of database-triggered cache invalidation, now you can remove or invalidate an item from the cache when data in a SQL Server database changes. The database-triggered cache invalidation capability allows you to ensure that items in the cache are kept up to date with the changes in the database. ASP.NET 2.0 also provides you more control over the cached data by enabling you to set caching attributes at the SqlDataSource control level.
Now you can create custom cache dependencies by inheriting from the CacheDependency class which is no more a sealed class in ASP.NET 2.0. This make it easy to create your own custom cache dependencies required for a particular scenario. Also now you can be notified when an item is removed from the application cache. This way you can perform the required operation immediately.

How ASP .NET 2.0 Cache is better than the ASP .NET 1.1 Cache? A usual problem with ASP .NET 2.0 Cache is that sometimes Cache.Insert() method fails to insert the data into the cache and raises a null reference exception. What would you say about this?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.