CLC-3960 Refactor JSON cache logic

Following up on @ctweney's comment at https://github.com/ets-berkeley-edu/calcentral/pull/2701

This makes the "keeps an extra cache entry for JSON" flag clearer. It also adds tests and consolidates some tightly coupled logic (the format of the JSONfied key) which used to be split between two classes.