IMplements RepositoryCacheOptions to be able to have a more granular approach to how the base repository caches entities. Allows for a zero count caching as well which by default currently will be false since that's how it's inadvertently been until now, however have enabled a zero count cache for public access since this is queried very heavily on GetAll. Going to look at what other repositories do the same - Templates definitely does.

This commit is contained in:
Shannon
2015-01-29 15:39:41 +11:00
parent 1b161c8dbe
commit 47ec2572f5
9 changed files with 101 additions and 44 deletions

View File

@@ -1,6 +1,7 @@
using System;
using Umbraco.Core;
using Umbraco.Core.Cache;
using Umbraco.Core.Persistence.Repositories;
using Umbraco.Web.PublishedCache;
using Umbraco.Web.PublishedCache.XmlPublishedCache;
@@ -40,6 +41,8 @@ namespace Umbraco.Web.Cache
private void ClearCache()
{
ApplicationContext.Current.ApplicationCache.RuntimeCache.ClearCacheObjectTypes<DomainRepository.CacheableDomain>();
// SD: we need to clear the routes cache here!
//
// zpqrtbnk: no, not here, in fact the caches should subsribe to refresh events else we

View File

@@ -55,9 +55,6 @@ namespace Umbraco.Web.Cache
ApplicationContext.Current.ApplicationCache.RuntimeCache.ClearCacheItem(
string.Format("{0}{1}", CacheKeys.TemplateFrontEndCacheKey, id));
ApplicationContext.Current.ApplicationCache.RuntimeCache.ClearCacheItem(
string.Format("{0}{1}", CacheKeys.TemplateBusinessLogicCacheKey, id));
//need to clear the runtime cache for template instances
//NOTE: This is temp until we implement the correct ApplicationCache and then we can remove the RuntimeCache, etc...
ApplicationContext.Current.ApplicationCache.RuntimeCache.ClearCacheObjectTypes<ITemplate>();