public static void Stop() { lock (_sync) { HttpRuntime.Cache.Remove(instance._cacheKey); instance = null; } }
private KeepAlive(string applicationUrl, bool addRandom, Action<DateTime> customAction, Action<Exception> exceptionHandler) { _applicationUrl = applicationUrl; _addRandom = addRandom; _customAction = customAction; _exceptionHandler = exceptionHandler; _cacheKey = Guid.NewGuid().ToString(); instance = this; }
public static void Start(string applicationUrl, bool addRandom, Action<DateTime> customAction, Action<Exception> exceptionHandler) { if (IsKeepingAlive) { return; } lock (_sync) { if (instance == null) { instance = new KeepAlive(applicationUrl, addRandom, customAction, exceptionHandler); instance.Insert(); } } }