As part of my markdown server, I want to also occasionally clear out cached pages.
How would I create a thread that runs every XX seconds?
You can use the times module to keep track of time. I would use the epochTime proc, you can tell how much time has passed by storing the result of that proc and then subtracting the value you stored from the current value of epochTime:
import times, os
let start = epochTime()
sleep(1000)
echo(epochTime() - start)