feature: add filter to cache methods #2878
Merged
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.
Related:
Issue
The transient keys used for caching are hard to determine, making it hard to work with them as well.
Solution
This PR adds a filter as proposed in the issue, which allows developers to modify the transient key. It gives a maximum of 4 variables to work with:
Impact
As this is a new filter, it does not affect existing code.
Usage Changes
I added the parameters in a docblock as well. Although I am not sure if I did that the right way, so assistance would be appreciated here.
Considerations
This is the only way I see to help developers such as those in the original issue, without modifying existing transient keys.
Testing
I added a test to see if the filter works properly, which passes.