public AccountDatabaseCacheDependency(string key,AccountDatabaseCacheDependencyState state, int pollTime) : base(key, pollTime) { _state = state; //Polling = pollTime; }
/// <summary> /// Starts the store auto saving. /// </summary> public static void StartStoreAutoSaving() { // save store to disk every hour. TimeSpan dueTime = new TimeSpan(0,0,0,60,0); if ( System.Web.HttpContext.Current == null ) { autoSavingTimer = new Timer(new TimerCallback(SaveAccountDatabase), null, dueTime, dueTime); } else { // Timer timer = new Timer(new TimerCallback(SaveAccountDatabase), null, dueTime, dueTime); // System.Web.HttpRuntime.Cache.Insert("SalsTimer", timer); AccountDatabaseCacheDependencyState state = new AccountDatabaseCacheDependencyState(); state.CurrentAccountCount = AccountManager.AccountDatabase.Accounts.Length; state.AccountDatabasePath = System.Web.HttpContext.Current.Server.MapPath("users/AccountDatabase.xml"); AccountDatabaseCacheDependency dep = new AccountDatabaseCacheDependency("AccountDBUpdate", state, 120); // Create the cache entry CacheHelper.Insert("AccountDBUpdate", state, dep); } }