Trigger tasks via a request in a plug-in

I want to create a plug-in which can be triggered with a button in the backend (like clearing the cache). I took a look at the admin plug-in, but I couldn’t figure out what parts it takes to create a task that can be run by a request. Can someone give me an idea, what parts I need to add to my plug-in to make it work?
Thanks in advance.