/// <summary> /// Refresh cached data. /// </summary> /// <param name="userContext">User context.</param> protected override void RefreshCache(IUserContext userContext) { lock (FactorOrigins) { FactorOrigins.Clear(); } lock (FactorUpdateModes) { FactorUpdateModes.Clear(); } lock (FactorFieldTypes) { FactorFieldTypes.Clear(); } lock (PeriodTypes) { PeriodTypes.Clear(); } lock (Periods) { Periods.Clear(); } lock (IndividualCategories) { IndividualCategories.Clear(); } lock (FactorFieldEnums) { FactorFieldEnums.Clear(); } lock (FactorDataTypes) { FactorDataTypes.Clear(); } lock (Factors) { Factors.Clear(); } lock (FactorTrees) { FactorTrees.Clear(); } lock (FactorTreeNodes) { FactorTreeNodes.Clear(); } lock (OrganismGroups) { OrganismGroups.Clear(); } }
/// <summary> /// Get a factor tree node for specified locale by the spcified factor id. /// </summary> /// <param name="locale">Locale.</param> /// <param name="factorId">The specified factor id.</param> /// <param name="getOnlyPublicFactors">Get only public factor trees or all from cache.</param> /// <returns>A factor tree node related to the specified factor id for specified locale.</returns> protected override IFactorTreeNode GetFactorTreeNode(ILocale locale, int factorId, Boolean getOnlyPublicFactors) { String factorTreeType = getOnlyPublicFactors ? FactorTreesPermissionType.PublicFactorTrees.ToString() : FactorTreesPermissionType.AllFactorTrees.ToString(); IFactorTreeNode factorTreeNode = null; lock (FactorTreeNodes) { if (FactorTreeNodes.ContainsKey(locale.ISOCode + "#" + factorTreeType)) { factorTreeNode = ((Dictionary <int, IFactorTreeNode>)(FactorTreeNodes[locale.ISOCode + "#" + factorTreeType]))[factorId]; } } return(factorTreeNode); }