-
Notifications
You must be signed in to change notification settings - Fork 24
Add wp cache flush-group
for flushing a cache group
#85
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
Add wp cache flush-group
for flushing a cache group
#85
Conversation
Needs extra input for testing.
Also phpcs formatting.
src/Cache_Command.php
Outdated
* # Clear cache group. | ||
* $ wp cache clear-group my_group | ||
* | ||
* @subcommand clear-group |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@spacedmonkey Should it be wp cache clear-group
, wp cache delete-group
, or wp cache flush-group
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tillkruss Maybe you might have an opinion on naming ^ ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd stick with wp cache flush-group
to be identical to wp_cache_flush_group()
, but I'm a fan of @alias wp cache clear-group
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm... I think it should've been named wp_cache_delete_group()
in core 😁
flush-group
is too close to flush
, in my opinion. But, I guess we should be consistent with naming.
@wp-cli/committers Any other opinions to bring into the mix?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, alias delete
and clear
makes sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having worked on it a bit more I think I would prefer flush-group
it might be close to the existing flush
but I think its more consistent that way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having worked on it a bit more I think I would prefer
flush-group
it might be close to the existingflush
but I think its more consistent that way.
Sounds good to me 👍
features/cache.feature
Outdated
Then STDERR should be: | ||
""" | ||
Warning: Cache group 'false_return' was not be flushed. | ||
""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know how to create/fake a cache implementation for better behat testing.
@spacedmonkey Are there any cache implementations you're aware of that we could easily install?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could use this as upstream: https://github.com/rhubarbgroup/redis-cache/blob/develop/includes/object-cache.php
It will always have the latest Redis implementation ahead of releases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
I might try to find a SQLite implementation so we don't have to add Redis to CI.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or APCu.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank's I'll take a look tomorrow or monday.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://github.com/OllieJones/sqlite-object-cache does not like WP-CLI....
But I added a mu-plugin that overrides the $GLOBALS['wp_object_cache']
.
Ideally a drop-in would be created but that would be bigger then the whole feature test file.
This also works.
wp cache clear-group
for flushing a cache group
@danielbachhuber the failed tests are valid, the errors should trigger with older WP versions. |
@janw-me Yes, please:
|
@danielbachhuber Where I do personally agree, I think delete group would be better. But there are plugins that used that already so we could not use it. Let's use flush-group, as this is the naming in core, even through it sucks, it sucks in the WordPress way. |
Fixed failing test and generated readme file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like just one more minor tweak and then this is ready to 🚢
Then STDOUT should be: | ||
""" | ||
Success: Cache group 'add_multiple' was flushed. | ||
""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You'll want to move this step to a new scenario so you can control it with @require-wp-6.1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work @janw-me 👍
wp cache clear-group
for flushing a cache groupwp cache flush-group
for flushing a cache group
Needs extra input for testing.
I don't know how to create/fake a cache implementation for better behat testing.
Fixes #80