Here's the purge Cache task. Just follow the pattern to implement your own tasks. Make sure when registering the task you get the nameSpace and assembly correct.
Imports System.IO
Imports System.Reflection
Imports DotNetNuke.Services.Cache
Imports DotNetNuke.Services.Exceptions
Imports DotNetNuke.Common
Imports DotNetNuke.Common.Utilities
Namespace DotNetNuke.Services.Cache
Public Class PurgeCache
Inherits DotNetNuke.Services.Scheduling.SchedulerClient
Public Sub New(ByVal objScheduleHistoryItem As DotNetNuke.Services.Scheduling.ScheduleHistoryItem)
MyBase.new()
Me.ScheduleHistoryItem = objScheduleHistoryItem 'REQUIRED
End Sub
Public Overrides Sub DoWork()
Try
Dim str As String = CachingProvider.Instance.PurgeCache()
Me.ScheduleHistoryItem.Succeeded = True 'REQUIRED
Me.ScheduleHistoryItem.AddLogNote(Str)
Catch exc As Exception 'REQUIRED
Me.ScheduleHistoryItem.Succeeded = False 'REQUIRED
Me.ScheduleHistoryItem.AddLogNote(String.Format("Purging cache task failed.", exc.ToString)) 'OPTIONAL
'notification that we have errored
Me.Errored(exc) 'REQUIRED
'log the exception
LogException(exc) 'OPTIONAL
End Try
End Sub
End Class
End Namespace