Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved caching in multiple areas #5822

Merged
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions DNN Platform/Library/Entities/Tabs/TabController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1394,9 +1394,9 @@ public TabInfo GetTab(int tabId, int portalId, bool ignoreCache)
// correctly, this may occurred when install is set up in web farm.
tab = CBO.FillObject<TabInfo>(this.dataProvider.GetTab(tabId));

// if tab is not null means that the cache doesn't update correctly, we need clear the cache
// and let it rebuild cache when request next time.
if (tab != null)
// if tab is not null, and it is for "portalId", that means that the cache doesn't update correctly,
// we need to clear the cache and let it rebuild cache when request next time.
if (tab != null && tab.PortalID == portalId)
{
this.ClearCache(tab.PortalID);
}
Expand Down
19 changes: 17 additions & 2 deletions DNN Platform/Modules/HTML/Components/WorkflowStateController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,31 @@ namespace DotNetNuke.Modules.Html
public class WorkflowStateController
{
private const string WORKFLOWCACHEKEY = "Workflow{0}";
private const string WORKFLOWS_CACHE_KEY = "Workflows{0}";
skamphuis marked this conversation as resolved.
Show resolved Hide resolved
private const int WORKFLOWCACHETIMEOUT = 20;

private const CacheItemPriority WORKFLOWCACHEPRIORITY = CacheItemPriority.Normal;

/// <summary>GetWorkFlows retrieves a collection of workflows for the portal.</summary>
/// <summary>GetWorkFlows retrieves a collection of workflows for the portal from the cache.</summary>
/// <param name="portalID">The ID of the Portal.</param>
/// <returns>An <see cref="ArrayList"/> of <see cref="WorkflowStateInfo"/> instances.</returns>
public ArrayList GetWorkflows(int portalID)
{
return CBO.FillCollection(DataProvider.Instance().GetWorkflows(portalID), typeof(WorkflowStateInfo));
var cacheKey = string.Format(WORKFLOWS_CACHE_KEY, portalID);
return CBO.GetCachedObject<ArrayList>(new CacheItemArgs(cacheKey, WORKFLOWCACHETIMEOUT, WORKFLOWCACHEPRIORITY, portalID), this.GetWorkflowsCallBack);
}

/// -----------------------------------------------------------------------------
/// <summary>
/// GetWorkflowsCallBack retrieves a collection of WorkflowStateInfo objects for the Portal from the database.
/// </summary>
/// <param name = "cacheItemArgs">Arguments passed by the GetWorkflowStates method.</param>
/// <returns>WorkflowStateInfo List.</returns>
/// -----------------------------------------------------------------------------
public object GetWorkflowsCallBack(CacheItemArgs cacheItemArgs)
skamphuis marked this conversation as resolved.
Show resolved Hide resolved
{
var portalId = (int)cacheItemArgs.ParamList[0];
return CBO.FillCollection(DataProvider.Instance().GetWorkflows(portalId), typeof(WorkflowStateInfo));
}

/// <summary>GetWorkFlowStates retrieves a collection of WorkflowStateInfo objects for the Workflow from the cache.</summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ namespace Dnn.PersonaBar.UI.Services.DTO
using System.Runtime.Serialization;

[DataContract]
[Serializable]
public class FrameworkQueryDTO
{
[DataMember(Name = "UpToDate")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,12 @@
namespace Dnn.PersonaBar.UI.Services.DTO
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Web;

using DotNetNuke.Security.Roles;

[DataContract]
[Serializable]
public class RoleGroupDto
{
/// <summary>Initializes a new instance of the <see cref="RoleGroupDto"/> class.</summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@

namespace Dnn.PersonaBar.UI.Services.DTO
{
using System;
using System.Runtime.Serialization;

[DataContract]
[Serializable]
public class SuggestionDto
{
[DataMember(Name = "value")]
Expand Down
Loading