Skip to content

Support WP-Stash in 'wp cache type' #68

@Biont

Description

@Biont

Greetings.

I just looked around the wp cache type command after seeing it returns "Unknown" in our WP instances running WP Stash. I think it would be pretty useful if we could see that a site is indeed running WP-Stash - and possibly which driver is in use.

I see that determining the cache type is a "manual" process that checks for the specifics of several implementations. So would you be supportive of adding WP Stash to the list of implementations to check against?

The most basic check would probably be class_exists('Inpsyde\WpStash\WpStash') and it could return get_class( WpStash::instance()->driver() ). This would yield the FQCN of the StashPHP driver that is currently being used.

I hope you consider this a worthwhile addition - which I'd happily PR your way.

As a side note: Wouldn't it make sense to provide a generic way for implementations to TELL wp-cli what's being used? The ideal solution would be of course if WP-Core had such a thing on offer, but in the absence of this: is there an inherent problem with checking for the existence of $wp_object_cache->type - or maybe even calling wp_cache_type() if it exists?

In addition, maybe you could return 'Unknown: ' . get_class( $wp_object_cache ), so users with entirely custom solutions would at least get some result.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions