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
Describe your use case and the problem you are facing
For yet another persistent object cache implementation, this one via SQLite (https://github.com/OllieJones/sqlite-object-cache) it would be nice if thewp cache type command returned something more useful than Unknown.
Proposal: change near line 256 to add the following bit of code. This will use a method in the cache implementation if it's available to get the cache type.
// Use the get_cache_type method if the cache implements it.if ( method_exists( $wp_object_cache, 'get_cache_type' ) ) {
$message = $wp_object_cache->get_cache_type();
// Test for Memcached PECL extension memcached object cache (https://github.com/tollmanz/wordpress-memcached-backend)
} elseif ( isset( $wp_object_cache->m ) && $wp_object_cache->m instanceof \Memcached ) {
...
This allows future object cache implementations (like mine) to have support from the wp cache type command without needing to embed any more implementation specifics in utils-wp.php. And, future releases of existing caches can easily adapt.
The text was updated successfully, but these errors were encountered:
OllieJones
added a commit
to OllieJones/sqlite-object-cache
that referenced
this issue
Feb 1, 2023
We generally try to mirror core's implementation as much as possible. If core implemented a get_cache_type() method on the main WP_Object_Cache class, we could call that.
Until then, we'd be happy to add some detection for your object cache drop-in. There aren't so many object cache drop-ins that maintaining the list is a problem.
Feature Request
wp cache type
retrieves and displays the type of persistent object cache. Make it more easily extensible.Describe your use case and the problem you are facing
For yet another persistent object cache implementation, this one via SQLite (https://github.com/OllieJones/sqlite-object-cache) it would be nice if the
wp cache type
command returned something more useful thanUnknown
.Describe the solution you'd like
It uses an if / else if cascade in
wp_get_cache_type()
starting at https://github.com/wp-cli/wp-cli/blob/main/php/utils-wp.php#L255 to look for implementation specifics for each known type of cache and guess the cache type.Proposal: change near line 256 to add the following bit of code. This will use a method in the cache implementation if it's available to get the cache type.
This allows future object cache implementations (like mine) to have support from the
wp cache type
command without needing to embed any more implementation specifics in utils-wp.php. And, future releases of existing caches can easily adapt.The text was updated successfully, but these errors were encountered: