CacheAdapter 4.2.0 Released

The latest version of cache adapter has now been released and is available via Nuget or you can download the source code here.

Note: For those who don’t know what cache adapter is, you can check out the wiki here or you can look at some previous blog posts here which also has links to other posts.

The nuget packages for the core component and the package with all configuration and code examples are:

What is in this release

This is only a relatively minor release but does contain some useful additions, as well as addressing some outstanding issues. The list of items addressed in this release are:

  • Addition of a licence file Issue #49
  • Fixing a bug where multiple configuration instances are created Issue #40
  • Fluent configuration Issue #50

Fluent Configuration

Previously, configuration of the cache adapter in code wa a little tedious. Now however, you can do this:

using Glav.CacheAdapter.Helpers;

var provider = CacheConfig.Create()
     .UseMemcachedCache()
     .UsingDistributedServerNode("127.0.0.1")
     .BuildCacheProviderWithTraceLogging();

provider.Get<MyObject>("cacheKey", DateTime.Now.AddHours(1), () =>
     {
         return GetMyDataFromTheStore();
     });

Breaking Change: Normalised configuration

There was previously 2 ways of expressing configuration in the configuration file. Due to a configuration system overhaul, this has now been changed to support only one. Specifically, the configuration section option has been removed and now only the <appSettings> method of configuration is supported. So if you had something like:

<applicationSettings>
        <Glav.CacheAdapter.MainConfig>
            <setting name="CacheToUse" serializeAs="String">
                <value>memcached</value>
            </setting>
            <setting name="DistributedCacheServers" serializeAs="String">
                <value>localhost:11211</value>
            </setting>
        </Glav.CacheAdapter.MainConfig>
</applicationSettings>

That should now be changed to:

<appSettings>
  <add key="Cache.CacheToUse" value="memcached" />
  <add key="Cache.DistributedCacheServers" value="localhost:11211" />
</appSettings>

That is about it for the changes. Hope you find them useful. Feel free to let me know any suggestions or even perhaps create a pull request for any features you think are valuable additions.

2 Comments

  • Thanks

  • Hi Paul,

    First thanks a lot for your adapter :-).
    I am new to a CacheAdapter and just going through the basic examples, have a couple of questions:
    1) Would it be possible to implement some kind of AOP to 'relax' the calling code?
    2) What would be the correct way of writing unit tests for the Adapter's calls?


    Thanks.

Add a Comment

As it will appear on the website

Not displayed

Your website