Public Class scheduledTaskService Inherits System.Web.Services.WebService _ Public Function cacheProcedure() As String 'Check for the existence of cache Dim cacheKey As String = "scheduleCacheKey" If IsNothing(HttpRuntime.Cache.Item(cacheKey)) Then 'Declare the callback routine Dim callbackDelegate As CacheItemRemovedCallback Dim cc As New cacheCallback callbackDelegate = New CacheItemRemovedCallback(AddressOf cc.callbackRoutine) 'Add to cache and set the callback HttpRuntime.Cache.Insert(cacheKey, "", Nothing, DateTime.Now.AddMinutes(5), TimeSpan.Zero, Caching.CacheItemPriority.Normal, callbackDelegate) End If End Function End Class