You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add command would map to the method cache_add on WP_Theme class.
Get command would map to the method cache_get on WP_Theme class.
Delete command would map to the method cache_delete on WP_Theme class.
This would help manage and clear theme related caches.
WP_Theme::cache_add() and WP_Theme::cache_get() are private, so we can't really use these.
The delete method is public, but maybe this could be used via wp cache delete and wp cache flush-group? The cache key property itself is also private though, so we can't really access it.
WP_Theme::cache_add() and WP_Theme::cache_get() are private, so we can't really use these.
It maybe possible to use a reflection or copy the logic from inside these methods.
The delete method is public, but maybe this could be used via wp cache delete and wp cache flush-group? The cache key property itself is also private though, so we can't really access it.
It is not possible, as the cache key is not predictable. See. Cache key have been salted with a cache hash. Not be mention the other cache clearing that happens in the cache_delete method.
Can we maybe try to replicate the exact functions being internally used in class-wp-theme.php for these functions? We can replicate the entire logic for the functions and along with it replicate the cache related dependencies for the CLI Command like cache_expiration and cache_hash as well.
Can we maybe try to replicate the exact functions being internally used in class-wp-theme.php for these functions? We can replicate the entire logic for the functions and along with it replicate the cache related dependencies for the CLI Command like cache_expiration and cache_hash as well.
The benefit would be that we shall be able to replicate the complete functionality of the private functions WP_Theme::cache_add() and WP_Theme::cache_get() directly for our CLI commands without creating any wrapper functions in the class-wp-theme.php
While I had a WIP PR in #494, I am still not sure about this. Don't really see the use case for the proposed cache add and cache get commands. What would one do with these? 🤷 wp theme cache flush <theme> and wp theme cache delete <theme> are more interesting for cleanup purposes.
Activity
spacedmonkey commentedon Jan 16, 2024
This would be useful for cache invalidation of theme caches, related to current performance work.
CC @swissspidy @joemcgill @felixarntz
danielbachhuber commentedon Jan 16, 2024
I amenable to this. Feel free to submit a pull request, if you'd like. Here is some guidance on our pull request best practices.
swissspidy commentedon Jan 16, 2024
WP_Theme::cache_add()andWP_Theme::cache_get()are private, so we can't really use these.The delete method is public, but maybe this could be used via
wp cache deleteandwp cache flush-group? The cache key property itself is also private though, so we can't really access it.spacedmonkey commentedon Jan 17, 2024
It maybe possible to use a reflection or copy the logic from inside these methods.
It is not possible, as the cache key is not predictable. See. Cache key have been salted with a cache hash. Not be mention the other cache clearing that happens in the
cache_deletemethod.mchirag2002 commentedon May 31, 2024
Can we maybe try to replicate the exact functions being internally used in
class-wp-theme.phpfor these functions? We can replicate the entire logic for the functions and along with it replicate the cache related dependencies for the CLI Command like cache_expiration and cache_hash as well.spacedmonkey commentedon Jun 1, 2024
What would the be the benefit of that?
mchirag2002 commentedon Jun 3, 2024
The benefit would be that we shall be able to replicate the complete functionality of the private functions
WP_Theme::cache_add()andWP_Theme::cache_get()directly for our CLI commands without creating any wrapper functions in theclass-wp-theme.phpswissspidy commentedon Feb 17, 2026
While I had a WIP PR in #494, I am still not sure about this. Don't really see the use case for the proposed
cache addandcache getcommands. What would one do with these? 🤷wp theme cache flush <theme>andwp theme cache delete <theme>are more interesting for cleanup purposes.swissspidy commentedon Aug 10, 2026
See also: