Add serializer name to cache namespace #193
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Current Behaviour
When different serializations of the same object are created, the cache namespace and key used is the same, which can cause the wrong representation to be retrieved.
For example, if an "index" page for "Articles" uses a lightweight "preview" representation of each article to show a thumbnail image, and headline, but the "show" page uses a full serialization including the article content, metadata, author information, etc. then on navigating to the "show" page the cache will return the "preview" serialization.
The exception to this is a serialization using parse fieldsets, which modifies the cache namespace to avoid collisions between the default serialization and the serialization using a specified fieldset.
New Behaviour
The name of the serializer being invoked is added to the namespace (in addition to the fieldset, if it exists), which will avoid these collisions.
References
This should address these issues from the beforetime:
Netflix/fast_jsonapi/issues/300
Netflix/fast_jsonapi/issues/389
Netflix/fast_jsonapi/issues/394