Improve caching of the catalog

It turns out the catalog is already designed to cache each class individually, so that if a student registers, only that class's entry has to be recomputed.  Unfortunately, due to #866, this wasn't happening, even though the dependencies were set correctly.  Now it should work.  This will hopefully save a lot of
computation during student registration, so we may want to merge it to sites that have large student registrations open.  I already merged to mit-prod.

(While I was at it, I also made `Program.open_class_category` cached, which I think due to the other change will only make a small difference, but will still help a bit.)