Extract some common functions

These functions are all loosely related to revisions and the
revisions table.  They are currently used by pagecontent.js
and will later be used as well by parsoid.js (and possibly
others) when we start respecting cache-control: no-cache.

Does it make sense to treat these as library functions, or
should they be moved into a new handler of some sort?