Prioritize JIRA threads.

Stories with issues I'm assigned to, then that I've commented on, then everything else.

Also extracted caching logic into a class.