A module to extend the default database caching options for Orchard 1.x.
There are 3 basic levels of caching in NHibernate (the underlying data access mechanism for Orchard).
- There is the 1st level cache, which caches objects for the lifetime of a request. In other words, when you ask for the URL http://mysite.com/blog/posts/123, and during the request NHibernate loads up the blog post with Id #123, if the code asks for blog post #123 again during the request it will be taken from the cache. This is enabled by default, and Orchard leverages the first level cache out of the box.
- Then there is the 2nd level cache, which is similar to the first level cache except that it is persisted across requests. So if someone comes by and asks for blog post #123 shortly after you do, it will be loaded from the cache (as long as you haven't a) modified it and b) it hasn't been flushed out of the cache in the time being). This module enables the 2nd level cache. From my testing, this can cut out anywhere from 50%-75% of the database queries that orchard is making.
-The last of the basic caches is the query cache. This can be quite tricky to set up correctly, however Orchards rigid query structure makes it work very well. I was able to get this working, however not in a module form. Once enabled, it knocked out about 95% of the queries Orchard makes when combined with the 2nd level cache. I'm hoping to get this worked into this module somehow.
This module is still in beta, so feedback is appreciated.