Lazy Cache
One thing I’m finding, and I may have mentioned this before, is that lazy loading and distributed caching don’t play nice. Over the past few months I’ve been identifying heavily accessed objects in our application that seldom change and introducing caching. Up until recently that caching has been accomplished using the built-in ASP.NET in-memory cache . In tandem with this caching effort we’ve grown our website from a one node webserver to a N node web farm. With that comes the need for a distributed cache to keep the various node’s caches in sync. To accomplish distributed caching we’ve been using NCache , which is a great tool, very cool. However, one of the major differences between in-memory caches and distributed caches, is that in-memory caches are direct memory references to the object, while distributed caches work with serialized copies of the objects. If you’re not already familiar with the problem you’re probably starting to see why that’s an issue for lazy loading.