Skip to content

Commit

Permalink
Merge pull request #127 in TSI/dxa-modules from feature/TSI-3302 to d…
Browse files Browse the repository at this point in the history
…evelop

* commit 'e835e4f594a79462478fd4976ff27083a335bcbd':
  TSI-3302 : Turn off caching when sending requests with conditions
  • Loading branch information
majiccode committed Jun 8, 2018
2 parents e39d018 + e835e4f commit 520c172
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
7 changes: 6 additions & 1 deletion webapp-net/TridionDocs/Providers/TocProvider.cs
Expand Up @@ -3,6 +3,7 @@
using Sdl.Web.Common.Interfaces;
using Sdl.Web.Common.Models;
using Sdl.Web.Common.Models.Navigation;
using Sdl.Web.Delivery.Service;
using Sdl.Web.Mvc.Configuration;

namespace Sdl.Web.Modules.TridionDocs.Providers
Expand All @@ -24,6 +25,8 @@ public IEnumerable<SitemapItem> GetToc(int publicationId, string sitemapItemId,
public IEnumerable<SitemapItem> GetToc(int publicationId, string sitemapItemId, bool includeAncestors,
int descendantLevels)
{
bool caching = ServiceCacheProvider.Instance.DisableCaching;
ServiceCacheProvider.Instance.DisableCaching = true;
IOnDemandNavigationProvider onDemandNavigationProvider = SiteConfiguration.NavigationProvider as IOnDemandNavigationProvider;
NavigationFilter navigationFilter = new NavigationFilter
{
Expand All @@ -34,7 +37,9 @@ public IEnumerable<SitemapItem> GetToc(int publicationId, string sitemapItemId,
ILocalization localization = WebRequestContext.Localization;
localization.Id = publicationId.ToString();

return onDemandNavigationProvider.GetNavigationSubtree(sitemapItemId, navigationFilter, localization);
var result = onDemandNavigationProvider.GetNavigationSubtree(sitemapItemId, navigationFilter, localization);
ServiceCacheProvider.Instance.DisableCaching = caching;
return result;
}
}
}
Expand Up @@ -4,6 +4,7 @@
using Sdl.Web.Common;
using Sdl.Web.Common.Interfaces;
using Sdl.Web.Common.Models;
using Sdl.Web.Delivery.Service;
using Sdl.Web.Modules.TridionDocs.Exceptions;
using Sdl.Web.Tridion.Mapping;
using Tridion.ContentDelivery.DynamicContent.Query;
Expand Down Expand Up @@ -48,6 +49,9 @@ public Category[] GetCategories()

public override PageModel GetPageModel(int pageId, ILocalization localization, bool addIncludes = true)
{
bool caching = ServiceCacheProvider.Instance.DisableCaching;
ServiceCacheProvider.Instance.DisableCaching = true;

PageModel pageModel = base.GetPageModel(pageId, localization, addIncludes);
if (pageModel != null)
{
Expand Down Expand Up @@ -84,6 +88,8 @@ public override PageModel GetPageModel(int pageId, ILocalization localization, b
}
}
}

ServiceCacheProvider.Instance.DisableCaching = caching;
return pageModel;
}

Expand Down
4 changes: 4 additions & 0 deletions webapp-net/TridionDocs/Sdl.Web.Modules.TridionDocs.csproj
Expand Up @@ -47,6 +47,10 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Sdl.Dxa.Framework.Web8.$(DxaFrameworkVersion)\\lib\net452\Sdl.Web.DataModel.dll</HintPath>
</Reference>
<Reference Include="Sdl.Web.Delivery.Service, Version=11.0.0.0, Culture=neutral, PublicKeyToken=ddfc895746e5ee6b, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Sdl.Web.Delivery.$(SdlDeliveryVersion)\lib\net452\Sdl.Web.Delivery.Service.dll</HintPath>
</Reference>
<Reference Include="Sdl.Web.Delivery.ServicesCore">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Sdl.Web.Delivery.$(SdlDeliveryVersion)\lib\net452\Sdl.Web.Delivery.ServicesCore.dll</HintPath>
Expand Down

0 comments on commit 520c172

Please sign in to comment.