/* * public static List<PageBO> PageList * { * get * { * string key = TableNames.Page + "_" + BusinessObject.OwnerCompanyID.ToString(); * * if (CachedData.CacheManager[key] == null) * { * PageBO objPage = new PageBO(); * objPage.Company = BusinessObject.OwnerCompanyID; * Add(key, objPage.SearchObjects()); * } * * return (List<PageBO>)CachedData.CacheManager[key]; * } * set * { * string key = TableNames.Page + "_" + BusinessObject.OwnerCompanyID.ToString(); * if (CachedData.CacheManager[key] != null) * { * Remove(key); * } * * Add(key, value); * } * } */ #endregion #region Constructors static CachedData() { if (cacheManager == null) { cacheManager = MPEC.CacheFactory.GetCacheManager() as MPEC.CacheManager; } }
private UserCacheManager() { m_CacheManager = CacheFactory.GetCacheManager("Online User Cache Manager"); m_VirtualUser = new UserOnline { Token = "VirtualUser", UserId = -1 }; m_VirtualUser.Roles = new List<int>(); m_VirtualUser.Roles.Add(-1); }
/// <summary> /// Construct and initialize a CachableWcfBusinessActionProvider. /// </summary> /// <param name="applicationName">Application name</param> /// <param name="remoteAddress">Remote address of WCF business action service.</param> /// <param name="bindingName">The binding name of endpoint communicating with business action service.</param> /// <param name="behaviorName">The behavior name of endpoint communicating with business action service.</param> /// <param name="cacheManager">The name of cache manager.</param> public CacheableWcfBusinessActionProvider(string applicationName, string remoteAddress, string bindingName, string behaviorName, string cacheManager) : base(applicationName, remoteAddress, bindingName, behaviorName) { if (string.IsNullOrEmpty(cacheManager)) { this._cacheManager = CacheFactory.GetCacheManager(); } else { this._cacheManager = CacheFactory.GetCacheManager(cacheManager); } }
private void RegisterObject(IBuilderContext context, string name, CacheManager createdObject) { if (context.Locator != null) { ILifetimeContainer lifetime = context.Locator.Get<ILifetimeContainer>(typeof(ILifetimeContainer), SearchMode.Local); if (lifetime != null) { context.Locator.Add(new DependencyResolutionLocatorKey(typeof(CacheManager), name), createdObject); lifetime.Add(createdObject); } } }
public ProductData() { cache = CacheFactory.GetCacheManager("Loading Scenario Cache Manager"); dataProvider = new DataProvider(); }
public WebApplicationGallery(string feedXmlURI) { cache = CacheFactory.GetCacheManager(); // this.feedXmlURI = feedXmlURI; }
/// <summary> /// <para>Initialize a new instance of the <see cref="CachingStoreProvider"/> class.</para> /// </summary> public CachingStoreProvider(int slidingExpiration, int absoluteExpiration, CacheManager securityCacheManager) { this.slidingExpiration = slidingExpiration; this.absoluteExpiration = absoluteExpiration; this.securityCacheManager = securityCacheManager; }
private void QuickStartForm_Load(object sender, EventArgs e) { // Initialize image to embedded logo this.logoPictureBox.Image = GetEmbeddedImage("CachingQuickStart.logo.gif"); // Use the default cache manager for the primitive operations this.primitivesCache = CacheFactory.GetCacheManager(); this.productData = new ProductData(); // Initialize primitive operations forms this.enterNewItemForm = new EnterNewItemForm(); this.selectItemForm = new SelectItemForm(); this.selectMasterDataItemForm = new SelectMasterDataItemForm(); }
// ReSharper restore UnusedParameter.Local // ReSharper disable UnusedParameter.Local public MonitoringLogFilterClient(NameValueCollection nameValueParis) : this("MonitoringLogFilter") { _cacheManager = CacheFactory.GetCacheManager(); }
/// <summary> /// /// </summary> /// public void Init() { cacheManager = CacheFactory.GetCacheManager(this.configurationName); }
/// <summary> /// <c>CacheableDacHelper</c>클래스의 새 인스턴스를 초기화합니다. /// </summary> /// <param name="dbHelper">Sql처리를 수행하는 <c>SqlDbHelper</c>입니다.</param> /// <param name="connectionStringName">연결문자열 이름입니다.</param> /// <param name="cacheManager">캐시 관리자 입니다.</param> /// <param name="slidingExpiration">캐시 폐기 시간 입니다.</param> public CacheableDacHelper(SqlDbHelper dbHelper, string connectionStringName, CacheManager cacheManager, TimeSpan slidingExpiration) : base(dbHelper, connectionStringName) { this.cacheManager = cacheManager; this.slidingExpiration = slidingExpiration; }
/// <summary> /// <c>CacheableDacHelper</c>클래스의 새 인스턴스를 초기화합니다. /// </summary> /// <param name="dbHelper">Sql처리를 수행하는 <c>SqlDbHelper</c>입니다.</param> /// <param name="cacheManager">캐시 관리자 입니다.</param> /// <param name="slidingExpiration">캐시 폐기 시간 입니다.</param> public CacheableDacHelper(SqlDbHelper dbHelper, CacheManager cacheManager, TimeSpan slidingExpiration) : base(dbHelper) { this.cacheManager = cacheManager; this.slidingExpiration = slidingExpiration; }
private void SetPrimitiveCache() { try { if (_CacheManager == null) { _CacheManager = CacheFactory.GetCacheManager(); } } catch { _CacheManager = null; } }
public static void FlushCacheManager() { cacheManager = null; }
private CacheManager CreateCacheManager(string cacheManagerName) { CacheManager cacheManager = cacheManagers[cacheManagerName] as CacheManager; if (cacheManager != null) { return cacheManager; } CachingConfigurationView view = new CachingConfigurationView(ConfigurationContext); CacheManagerData cacheManagerData = view.GetCacheManagerData(cacheManagerName); CacheCapacityScavengingPolicy scavengingPolicy = new CacheCapacityScavengingPolicy(cacheManagerName, view); IBackingStore backingStore = backingStoreFactory.CreateBackingStore(cacheManagerName); Cache cache = new Cache(backingStore, scavengingPolicy); ExpirationPollTimer timer = new ExpirationPollTimer(); ExpirationTask expirationTask = CreateExpirationTask(cache); ScavengerTask scavengerTask = new ScavengerTask(cacheManagerName, view, scavengingPolicy, cache); BackgroundScheduler scheduler = new BackgroundScheduler(expirationTask, scavengerTask); cache.Initialize(scheduler); scheduler.Start(); timer.StartPolling(new TimerCallback(scheduler.ExpirationTimeoutExpired), cacheManagerData.ExpirationPollFrequencyInSeconds * 1000); cacheManager = new CacheManager(cache, scheduler, timer); cacheManagers.Add(cacheManagerName, cacheManager); return cacheManager; }
private void InitCache() { cacheMgr = (CacheManager)CacheFactory.GetCacheManager(); //string file = Path.Combine(HttpRuntime.AppDomainAppPath, "stateserver.state"); //Stream s = null; //try //{ // if (File.Exists(file)) // { // log.Debug("Analyzing StateServer persistance..."); // s = File.Open(file, FileMode.Open); // BinaryFormatter bf = new BinaryFormatter(); // List<LineControl> lineControls = (List<LineControl>)bf.Deserialize(s); // log.Debug(lineControls.Count + " lines retreived..."); foreach (LineControl lc in SnapshotService.GetSnapshot()) { log.Debug("Adding " + lc.directoryNumber + " to the cache."); cacheMgr.Add(lc.directoryNumber, lc); } // s.Close(); // s.Dispose(); // } //} //catch (Exception ex) //{ // log.Error("Unable to initialize cache: " + ex.Message); //} //finally //{ // if (s != null) // { // s.Close(); // s.Dispose(); // } //} }