Second Level Cache Alpha 2 Available

About a week ago I published on NuGet the Alpha-2 version of the EFCache. It does not contain a whole lot of new things. In fact it contains just one change – a fix to a bug which prevented from using the cache with databases containing null values. This bug was reported by multiple people and was quite easy to hit since having null values in the database is a very common scenario. The best part of the story is that I actually did not code the fix myself. The fix was kindly contributed by Teoni Valois. Teoni also created an EFCache implementation called DacheCache which uses Dache – a distribute cache for .NET – as the caching mechanisms. You can get DachCache from NuGet.
Again, thanks for the contribution and reporting issues (yes, the version for .NET Framework 4 will be included in the upcoming Beta release). If you hit the bug and gave up on using EFCache give the Alpha-2 a try.

Advertisement

6 thoughts on “Second Level Cache Alpha 2 Available

  1. Ali says:

    Hello,
    Is this cache universal? I mean, does it cache everything or we can say this specific query should be cacheable and this one should not. For example NHibernate has `Cacheable()` method for second level caching (session.Query().Cacheable().ToList()). I need session.Query().ToList() for private parts of the site and session.Query().Cacheable().ToList() for public parts of the site.

    Like

    • moozzyk says:

      Hi Ali,
      You can control what gets cached by implementing a custom caching policy. You just create a class derived from the CachingPolicy class and pass an instance of your custom caching policy when creating the CachingProviderSrevices. A default caching policy which allows caching everything is included (see this post for more details). Currently however the caching policy does not allow to control caching based on specific queries. Instead it is using a concept of a store entity set (from the caching perspective it is just a fancy way of saying “table”). You can also decide whether to cache results depending on the size. I don’t know NHibernate but caching based on a specific query (and, possibly, parameters) is an interesting option. I will add it to my backlog.

      Thanks,
      Pawel

      Like

  2. teonivalois says:

    It was implemented in my original pull request. Maybe it could help?

    Like

    • moozzyk says:

      Yes, but architecturally this cannot be done solely in the caching policy/caching mechanisms. I believe this needs to be driven by the EFCache which will make the solution much cleaner and will allow to avoid hacks. I added more details on this to the workitem on codeplex.

      Thanks,
      Pawel

      Like

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 )

Facebook photo

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

Connecting to %s

%d bloggers like this: