A caching package for Umbraco CMS. Automatically caches result of registered tree crawling and xpath results.
Use NuGet to install the package.
PM> Install-Package DangEasy.UCache
Add this setting to your web.config.
<add key="UCache:Enabled" value="true" />
// tell UCache your site node doctype
UCache.Instance.RegisterSiteNodeContentTypeAlias("site"); // will default to top level nodes if not set
// register with xpath
UCache.Instance.RegisterSingle("homepage", "//home");
UCache.Instance.RegisterCollection("blogPosts", "//home/blog/blogpost");
// register with a function
UCache.Instance.RegisterSingle("blogLanding", (rootNodeId) => ExampleContentService.GetBlogLandingNode(rootNodeId));
var home = UCache.Instance.Get("homepage");
var posts = UCache.Instance.Fetch("blogPosts");
var blog = UCache.Instance.Get("blogLanding") as Blog;
Cache clearing is aggressive. All content which is registered will be cleared on the following event:
PageCacheRefresher.CacheUpdated