Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: add filter to cache methods #2878

Merged
merged 2 commits into from Feb 24, 2024

Conversation

bitfactory-robin-martijn
Copy link
Contributor

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:

/*
 * @param string $trans_key The transient key.
 * @param string $key The cache key.
 * @param string $group The cache group.
 * @param string $cache_mode The cache mode.
*/

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.

Levdbas
Levdbas previously approved these changes Jan 26, 2024
Copy link
Member

@Levdbas Levdbas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @expedition-robin-martijn , this looks good to me. Thank you for taking the time for adding the filter docblocks!

@Levdbas Levdbas added this to the 2.1.0 milestone Feb 22, 2024
Copy link
Member

@nlemoine nlemoine left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All good, thank you @expedition-robin-martijn !

@nlemoine nlemoine merged commit b347677 into timber:2.x Feb 24, 2024
24 of 27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants