Add caching rulesets.

Especially for @@querybuilderjsonconfig as that can be several megabytes big.