public SOARolePropertyDefinitionCollection GetByRoleID(string roleID) { roleID.CheckStringIsNullOrEmpty("roleID"); SOARolePropertyDefinitionCollection result = SOARolePropertiesDefinitionCache.Instance.GetOrAddNewValue(roleID.ToRoleIDCacheKey(), (cache, key) => { SOARolePropertyDefinitionCollection properties = LoadByRoleID(roleID); MixedDependency dependency = new MixedDependency(new UdpNotifierCacheDependency(), new MemoryMappedFileNotifierCacheDependency()); cache.Add(key, properties, dependency); return properties; }); return result; }
public SOARolePropertyRowCollection GetByRole(IRole role, SOARolePropertyDefinitionCollection definition) { role.NullCheck("role"); SOARolePropertyRowCollection result = SOARolePropertiesCache.Instance.GetOrAddNewValue(role.ID.ToRoleIDCacheKey(), (cache, key) => { SOARolePropertyRowCollection properties = LoadByRole(role, definition); MixedDependency dependency = new MixedDependency(new UdpNotifierCacheDependency(), new MemoryMappedFileNotifierCacheDependency()); cache.Add(key, properties, dependency); return properties; }); return result; }
public static DependencyBase PrepareDependency() { if (false == File.Exists(InnerCacheHelper.cacheDependenceFile)) { lock (InnerCacheHelper.syncFile) { if (false == File.Exists(InnerCacheHelper.cacheDependenceFile)) File.Create(InnerCacheHelper.cacheDependenceFile); } } TimeSpan ts = new TimeSpan(0, 1, 0); MixedDependency result = new MixedDependency( new FileCacheDependency(InnerCacheHelper.cacheDependenceFile), new SlidingTimeDependency(new TimeSpan(AccreditSection.GetConfig().AccreditSettings.CacheSlideMinutes * ts.Ticks))); return result; }
public IWfProcessDescriptor GetDescriptor(string processKey) { processKey.CheckStringIsNullOrEmpty("processKey"); string cacheKey = NormalizeCacheKey(processKey); XElement processXml = WfProcessDescriptorXmlCache.Instance.GetOrAddNewValue(cacheKey, (cache, key) => { XElement xml = LoadXml(processKey); MixedDependency dependency = new MixedDependency(new UdpNotifierCacheDependency(), new MemoryMappedFileNotifierCacheDependency()); cache.Add(key, xml, dependency); return xml; }); return WfProcessDescriptorManager.DeserializeXElementToProcessDescriptor(processXml); }
/// <summary> /// 根据用户ID获取指定的配置 /// </summary> /// <param name="userID"></param> /// <returns></returns> public static UserRecentData GetSettings(string userID) { userID.CheckStringIsNullOrEmpty("userID"); UserRecentData result = UserRecentDataCache.Instance.GetOrAddNewValue(userID, (cache, key) => { UserRecentData settings = LoadSettings(userID); MixedDependency mixedDependency = new MixedDependency( new UdpNotifierCacheDependency(), new UserRecentDataCacheItemDependency(), new MemoryMappedFileNotifierCacheDependency()); cache.Add(key, settings, mixedDependency); return settings; }); return result; }
/// <summary> /// 根据用户ID和Category获取指定的配置 /// </summary> /// <param name="userID"></param> /// <returns></returns> public static UserRecentDataCategory GetSettings(string userID, string category) { userID.CheckStringIsNullOrEmpty("userID"); category.CheckStringIsNullOrEmpty("category"); var result = UserRecentDataCategoryCache.Instance.GetOrAddNewValue(new UserRecentDataCategoryCacheKey(userID, category), (cache, key) => { var categoryData = LoadSettings(key.UserId, key.Category); MixedDependency mixedDependency = new MixedDependency( new UdpNotifierCacheDependency(), new UserRecentDataCacheItemDependency(), new MemoryMappedFileNotifierCacheDependency()); cache.Add(key, categoryData, mixedDependency); return categoryData; }); return result; }