PERF: Cache categories in Site model take 3. (PR #13491)

Previous attempt resulted in custom fields going missing in the serialized output.

This reverts commit 83a6ad32ffe75ae222028feddeca169fc5be54ac.

GitHub

I have to move the preload of custom fields into the cache since this is the only location where we’re still dealing with AR objects.

Custom fields unfortunately do not rely on ActiveRecord callbacks since we write directly to the database.

This test is way too generic and does not test for the names of the attributes.