Description
When we deploy a new version of our codebase that includes changes to a json_fields
declaration (e.g., adding a new field), any cached data for that model should be invalidated. Instead, the stale data continues to be returned and a full cache clear is required before the correct fields are returned.
This could take the form of an additional version
option that's simply incremented by developers upon making changes that should invalidate cached results. (I'm not sure how to cleanly offer the option without potentially colliding with the model's actual field definitions, but it seems we already do something like this with hide_as_child_json_when
). A more sophisticated approach might be to include a hash of the json_fields
definition in the cache keys. This would change when the definition changes, automatically invalidating any previously cached data.