CacheAdapter 2.4 Bug fixes and minor functional update

Posted by: Glavs Blog, on 28 Mar 2012 | View original | Bookmarked: 0 time(s)

Note: If you are unfamiliar with the CacheAdapter library and what it does, you can read all about its awesome ability to utilise memory, Asp.Net Web, Windows Azure AppFabric and memcached caching implementations via a single unified, simple to use API from here and here..

The CacheAdapter library is receiving an update to version 2.4 and is currently available on Nuget here.


This latest version fixes a big that is only present in the memcached implementation and is only seen in rare, intermittent times (making i particularly hard to find). The bug is where a cache node would be removed from the farm when errors in deserialization of cached objects would occur due to serialised data not being read from the stream in entirety.

The code also contains enhancements to better surface serialization exceptions to aid in the debugging process. This is also specifically targeted at the memcached implementation. This is important when moving from something like memory or Asp.Web caching mechanisms to memcached where the serialization rules are not as lenient.

There are a few other minor bug fixes, code cleanup and a little refactoring.

Minor feature addition

In addition to this bug fix, many people have asked for a single setting to either enable or disable the cache.In this version, you can disable the cache by setting the IsCacheEnabled flag to false in the application configuration file. Something like the example below:

    <setting name="CacheToUse" serializeAs="String">
    <setting name="DistributedCacheServers" serializeAs="String">
    <setting name="IsCacheEnabled" serializeAs="String">

Your reasons to use this feature may vary (perhaps some performance testing or problem diagnosis). At any rate, disabling the cache will cause every attempt to retrieve data from the cache, resulting in a cache miss and returning null. If you are using the ICacheProvider with the delegate/Func<T> syntax to populate the cache, this delegate method will get executed every single time. For example, when the cache is disabled, the following delegate/Func<T> code will be executed every time:

var data1 = cacheProvider.Get<SomeData>("cache-key", DateTime.Now.AddHours(1), () =>
    // With the cache disabled, this data access code is executed every attempt to
    // get this data via the CacheProvider.
    var someData = new SomeData() { SomeText = "cache example1", SomeNumber = 1 };
    return someData;

One final note: If you access the cache directly via the ICache instance, instead of the higher level ICacheProvider API, you bypass this setting and still access the underlying cache implementation. Only the ICacheProvider instance observes the IsCacheEnabled setting.

Thanks to those individuals who have used this library and provided feedback. Ifyou have any suggestions or ideas, please submit them to the issue register on bitbucket (which is where you can grab all the source code from too)

Category: Refactor | Other Posts: View all posts by this blogger | Report as irrelevant | View bloggers stats | Views: 1070 | Hits: 6

Similar Posts

  • CacheAdapter 2.4 Bug fixes and minor functional update more
  • .NET RIA Services May 2009 Preview more
  • Continuous Deployment more
  • Subtext 2.1.1 Available Via the Web Platform Installer more
  • Silverlight 2 gets minor update more
  • Silverlight 2 Release Candidate Now Available more
  • How to define state machine in Windows Workflow Foundation (WF) more
  • Firefox 3 and Silverlight more
  • Visual Studio 2008 and .NET Framework 3.5 Service Pack 1 Beta more
  • AJAX UpdatePanel - "Statefull" Control Update Trigger more

News Categories

.NET | Agile | Ajax | Architecture | ASP.NET | BizTalk | C# | Certification | Data | DataGrid | DataSet | Debugger | DotNetNuke | Events | GridView | IIS | Indigo | JavaScript | Mobile | Mono | Patterns and Practices | Performance | Podcast | Refactor | Regex | Security | Sharepoint | Silverlight | Smart Client Applications | Software | SQL | VB.NET | Visual Studio | W3 | WCF | WinFx | WPF | WSE | XAML | XLinq | XML | XSD