Skip to content

Commit df634b6

Browse files
authored
Merge pull request #5822 from skamphuis/feature/5819-Improvements-Caching
Feature/5819 improvements caching
2 parents 7631f2c + 7bd3647 commit df634b6

File tree

5 files changed

+24
-8
lines changed

5 files changed

+24
-8
lines changed

DNN Platform/Library/Entities/Tabs/TabController.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1394,9 +1394,9 @@ public TabInfo GetTab(int tabId, int portalId, bool ignoreCache)
13941394
// correctly, this may occurred when install is set up in web farm.
13951395
tab = CBO.FillObject<TabInfo>(this.dataProvider.GetTab(tabId));
13961396

1397-
// if tab is not null means that the cache doesn't update correctly, we need clear the cache
1398-
// and let it rebuild cache when request next time.
1399-
if (tab != null)
1397+
// if tab is not null, and it is for "portalId", that means that the cache doesn't update correctly,
1398+
// we need to clear the cache and let it rebuild cache when request next time.
1399+
if (tab != null && tab.PortalID == portalId)
14001400
{
14011401
this.ClearCache(tab.PortalID);
14021402
}

DNN Platform/Modules/HTML/Components/WorkflowStateController.cs

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,31 @@ namespace DotNetNuke.Modules.Html
1313
public class WorkflowStateController
1414
{
1515
private const string WORKFLOWCACHEKEY = "Workflow{0}";
16+
private const string WORKFLOWSCACHEKEY = "Workflows{0}";
1617
private const int WORKFLOWCACHETIMEOUT = 20;
1718

1819
private const CacheItemPriority WORKFLOWCACHEPRIORITY = CacheItemPriority.Normal;
1920

20-
/// <summary>GetWorkFlows retrieves a collection of workflows for the portal.</summary>
21+
/// <summary>GetWorkFlows retrieves a collection of workflows for the portal from the cache.</summary>
2122
/// <param name="portalID">The ID of the Portal.</param>
2223
/// <returns>An <see cref="ArrayList"/> of <see cref="WorkflowStateInfo"/> instances.</returns>
2324
public ArrayList GetWorkflows(int portalID)
2425
{
25-
return CBO.FillCollection(DataProvider.Instance().GetWorkflows(portalID), typeof(WorkflowStateInfo));
26+
var cacheKey = string.Format(WORKFLOWSCACHEKEY, portalID);
27+
return CBO.GetCachedObject<ArrayList>(new CacheItemArgs(cacheKey, WORKFLOWCACHETIMEOUT, WORKFLOWCACHEPRIORITY, portalID), this.GetWorkflowsCallBack);
28+
}
29+
30+
/// -----------------------------------------------------------------------------
31+
/// <summary>
32+
/// GetWorkflowsCallBack retrieves a collection of WorkflowStateInfo objects for the Portal from the database.
33+
/// </summary>
34+
/// <param name = "cacheItemArgs">Arguments passed by the GetWorkflowStates method.</param>
35+
/// <returns>WorkflowStateInfo List.</returns>
36+
/// -----------------------------------------------------------------------------
37+
public ArrayList GetWorkflowsCallBack(CacheItemArgs cacheItemArgs)
38+
{
39+
var portalId = (int)cacheItemArgs.ParamList[0];
40+
return CBO.FillCollection(DataProvider.Instance().GetWorkflows(portalId), typeof(WorkflowStateInfo));
2641
}
2742

2843
/// <summary>GetWorkFlowStates retrieves a collection of WorkflowStateInfo objects for the Workflow from the cache.</summary>

Dnn.AdminExperience/Library/Dnn.PersonaBar.UI/Services/Dto/FrameworkQueryDTO.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ namespace Dnn.PersonaBar.UI.Services.DTO
88
using System.Runtime.Serialization;
99

1010
[DataContract]
11+
[Serializable]
1112
public class FrameworkQueryDTO
1213
{
1314
[DataMember(Name = "UpToDate")]

Dnn.AdminExperience/Library/Dnn.PersonaBar.UI/Services/Dto/RoleGroupDto.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,12 @@
55
namespace Dnn.PersonaBar.UI.Services.DTO
66
{
77
using System;
8-
using System.Collections.Generic;
9-
using System.Linq;
108
using System.Runtime.Serialization;
11-
using System.Web;
129

1310
using DotNetNuke.Security.Roles;
1411

1512
[DataContract]
13+
[Serializable]
1614
public class RoleGroupDto
1715
{
1816
/// <summary>Initializes a new instance of the <see cref="RoleGroupDto"/> class.</summary>

Dnn.AdminExperience/Library/Dnn.PersonaBar.UI/Services/Dto/SuggestionDto.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@
44

55
namespace Dnn.PersonaBar.UI.Services.DTO
66
{
7+
using System;
78
using System.Runtime.Serialization;
89

910
[DataContract]
11+
[Serializable]
1012
public class SuggestionDto
1113
{
1214
[DataMember(Name = "value")]

0 commit comments

Comments
 (0)