Conversation
ec0fe51 to
841448f
Compare
Codecov Report
@@ Coverage Diff @@
## develop #8 +/- ##
==============================================
+ Coverage 25.35% 39.24% +13.88%
- Complexity 102 131 +29
==============================================
Files 5 6 +1
Lines 280 344 +64
==============================================
+ Hits 71 135 +64
Misses 209 209
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
titouanmathis
left a comment
There was a problem hiding this comment.
This looks really useful! 👍
I have some thoughts and questions:
- the
TransientCleanermight be used as a service when creating new transients, should it implement the singleton pattern? - as a service, we might need to push a specific transient key to a specific part of the config, I think we need more methods to achieve that:
// Usage
$transient_cleaner = TransientCleaner::getInstance();
$transient_cleaner->addPostConfig('my_transient_key', 'my_cpt_name');
// Definition
public function addPostConfig( string $transient_key, $cpt_name = 'all' ) {
$this->config['post'][$cpt_name][] = $transient_key;
}146d8ad to
fff95f2
Compare
|
@studiometa/wordpress This PR is ready for review but #11 needs to be merged before merge this one.
Thanks for your feedbacks, in my opinion most of the time the config will be set only one time (on app init), so specific push methods aren't needed. $config = $cleaner->get_config();
$cleaner->set_config(
array_merge($config, ['post' => […]]);
); |
fff95f2 to
714de0e
Compare
714de0e to
e012023
Compare
|
Does this implementation support a configuration with wildcard caracters, or do we have to manually register all the transient keys ? When implementing ajax filters for exemple, transient key are generelly looking something like this: |
I think it does, as there is a |
Exactly it does thanks to This PR still a WIP, I need to push some fixes to make it working with WordPress Gutenberg post creation, and to validate test suite. |
Clean transients based on transient key and content save (post, term, option).
e012023 to
bdd47ef
Compare
e4f2250 to
f9e729d
Compare
f9e729d to
c5f2493
Compare
I fix test suite and Gutenberg compatibility, so this PR isn't a WIP anymore. Please can you (re)review it one last time? |
perruche
left a comment
There was a problem hiding this comment.
👏 👏 this is looking really good !
Motivation
Rather than (or in addition to) set a lifetime to a transient, we often need to clean a transient when a post is saved to update the front-office. So this PR introduce a way to clean transients based on a user-input configuration like the one below.
Todo