Skip to content

Conversation

@tollmanz
Copy link

@tollmanz tollmanz commented Sep 4, 2012

This commit adds commands for interacting with the WordPress object cache. For each public function in the WordPress object cache, a corresponding command has been created. Additionally, a "which" command has been written that attempts to determine which 3rd party object cache the current installation is implementing.

These commands allow a user to add/set, get, delete, etc. cached objects. The commands give simple access to cached data that can sometimes be difficulty to access.

This commit adds commands for interacting with the WordPress object cache. For each public function in for the WordPress object cache, a corresponding command has been created. Additionally, a "which" command has been written that attempts to determine which 3rd party object cache the current installation is implementing.
@scribu
Copy link
Member

scribu commented Sep 4, 2012

This command should have a man page. See /src/doc/ for examples and let me know if you have questions about that.

@tollmanz
Copy link
Author

tollmanz commented Sep 4, 2012

All of these suggestions are excellent! I will make the changes and submit new code.

@tollmanz
Copy link
Author

tollmanz commented Sep 5, 2012

@scribu Made suggested changes. It looks like the commits were pulled over automatically. Please let me know if there is a different way that you want me to do the pull request.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are there two checks for Memcache PECL?

Also, shouldn't those ifs be elseifs?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean like this:

if ( test for memcache ) {
    ...
} elseif ( test for APC ) {
    ...
} ...

@tollmanz
Copy link
Author

tollmanz commented Sep 5, 2012

There are 2 checks for different libraries that utilize memcached because there are 2 different WordPress memcached object cache backends: the original one by Ryan Boren (http://wordpress.org/extend/plugins/memcached/) that uses the memcache PECL extension, and a newer one my me (https://github.com/tollmanz/wordpress-memcached-backend) that uses the memached PECL extension (note the inclusion/exclusion of the "d"). These two memcached libraries are vastly different and I wanted to note which was being used.

Ideally, it would be nice if the object cache had a way of identifying itself in WordPress, but since that doesn't yet happen, I am merely guessing at the possibilities.

Good point about the if/elseif usage. I would normally return data after one of the conditions matched, but that does not work for this function and I should have altered my style a bit. I'll get a new commit in to fix that.

@scribu
Copy link
Member

scribu commented Sep 5, 2012

Ok, thanks; didn't notice the 'd'. I think the " (Memcached PECL extension)" qualifier doesn't help either.

It should just be "Memcache" or "Memcached".

@tollmanz
Copy link
Author

tollmanz commented Sep 5, 2012

Fair enough...will do.

scribu pushed a commit that referenced this pull request Sep 6, 2012
Added commands for the WordPress object cache
@scribu scribu merged commit 8422435 into wp-cli:master Sep 6, 2012
@scribu
Copy link
Member

scribu commented Sep 6, 2012

I merged the pull request; thanks for that!

I removed wp cache switch_to_blog because it's effect isn't persistent, so it wouldn't actually do anything.

Besides, if you need to operate on a certain blog, you already have the --blog global parameter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants