Cache the result of a callback for x milliseconds