public CheckPublishDateChangeMonitor(string key, object cachedItem, GetLastPublishDate getLastPublishDateCallBack, int interval) { LoggerService.Debug(">>CheckPublishDateChangeMonitor({0}, {1})", key, cachedItem.ToString()); this._key = key; this._cachedItem = cachedItem; _getLastPublishDateCallBack = getLastPublishDateCallBack; bool initializationComplete = false; try { _lastPublished = _getLastPublishDateCallBack(key, cachedItem); _timer = new Timer(); _timer.Interval = interval * 1000; // interval is configured in seconds but must be set in milliseconds! _timer.Elapsed += new ElapsedEventHandler(CheckForChanges); _timer.Enabled = true; _timer.Start(); initializationComplete = true; } finally { base.InitializationComplete(); if (!initializationComplete) { Dispose(true); } } base.InitializationComplete(); }
public LastPublishDateChangeMonitor(string key, object cachedItem, GetLastPublishDate getLastPublishDateCallBack) { LoggerService.Debug(">>LastPublishDateChangeMonitor({0}, {1})", key, cachedItem.ToString()); this._key = key; this._cachedItem = cachedItem; _getLastPublishDateCallBack = getLastPublishDateCallBack; bool initializationComplete = false; try { _lastPublished = _getLastPublishDateCallBack(key, cachedItem); _timer = new Timer(); int interval = DefaultCallBackInterval; string configuredInterval = ConfigurationHelper.GetSetting("CacheSettings_CallBackInterval"); if (!string.IsNullOrEmpty(configuredInterval)) { try { interval = Convert.ToInt32(configuredInterval); } catch { // fall back to default setting } } _timer.Interval = interval * 1000; // interval is configured in seconds but must be set in milliseconds! _timer.Elapsed += new ElapsedEventHandler(CheckForChanges); _timer.Enabled = true; _timer.Start(); initializationComplete = true; } finally { base.InitializationComplete(); if (!initializationComplete) { Dispose(true); } } base.InitializationComplete(); }
public LastPublishDateChangeMonitor(string key, object cachedItem, GetLastPublishDate getLastPublishDateCallBack) { LoggerService.Debug(">>LastPublishDateChangeMonitor({0}, {1})", key, cachedItem.ToString()); this._key = key; this._cachedItem = cachedItem; _getLastPublishDateCallBack = getLastPublishDateCallBack; bool initializationComplete = false; try { _lastPublished = _getLastPublishDateCallBack(key, cachedItem); _timer = new Timer(); int interval = DefaultCallBackInterval; string configuredInterval = ConfigurationHelper.GetSetting("CacheSettings_CallBackInterval"); if (! string.IsNullOrEmpty(configuredInterval)) { try { interval = Convert.ToInt32(configuredInterval); } catch { // fall back to default setting } } _timer.Interval = interval * 1000; // interval is configured in seconds but must be set in milliseconds! _timer.Elapsed += new ElapsedEventHandler(CheckForChanges); _timer.Enabled = true; _timer.Start(); initializationComplete = true; } finally { base.InitializationComplete(); if (!initializationComplete) { Dispose(true); } } base.InitializationComplete(); }
public CheckPublishDateChangeMonitor(string key, object cachedItem, GetLastPublishDate getLastPublishDateCallBack, int interval) { LoggerService.Debug(">>CheckPublishDateChangeMonitor({0}, {1})", key, cachedItem.ToString()); this._key = key; this._cachedItem = cachedItem; _getLastPublishDateCallBack = getLastPublishDateCallBack; bool initializationComplete = false; try { _lastPublished = _getLastPublishDateCallBack(key, cachedItem); _timer = new Timer(); _timer.Interval = interval * 1000; // interval is configured in seconds but must be set in milliseconds! _timer.Elapsed += new ElapsedEventHandler(CheckForChanges); _timer.Enabled = true; _timer.Start(); initializationComplete = true; } finally { base.InitializationComplete(); if (!initializationComplete) { Dispose(true); } } base.InitializationComplete(); }