Skip to content
This repository has been archived by the owner. It is now read-only.

Fully working implementation #9

merged 31 commits into from Mar 7, 2014


None yet
2 participants
Copy link

commented Mar 4, 2014

I went through what had been started and finished the plugin. It implements all of the functions Core specifies and by extension, their methods in WP_Object_Cache.

I also added support for the Redis PECL module and better error handling for failed Redis connections.

I've been using it on my personal site ( for a few days without issue. It could surely use further review before widespread use, but we're close to something worth releasing!

ethitter added some commits Feb 27, 2014

Allow default configuration to be overridden by constants in wp-confi…

Supports alternative Redis configurations without requiring hacks to the plugin file
Correct error in how additional global and non-persistent groups are …
…added, which corrupted the arrays holding those groups.

In 868c0a8, I blindly copied two missing functions from another object caching plugin, not paying enough attention to how that plugin managed the data versus how this plugin does. As a result, the arrays of groups had some entries keyed by the group, others were unkeyed and the value represented the group.
Simplify `get()` method's logic rather than duplicating Redis lookup …

Also fixes a code error introduced in 01b7283, where the key, not the retrieved value, was passed to the `restore_value_from_redis()` method.
Correct order of arguments passed to `setex()` as they were incorrect…
…--the expiration and value to cache were inverted.

Bug has existed since baa6de5 but was masked by serialization bug fixed in 01b7283.
Remove irrelevant arguments related to multiple servers (holdover fro…
…m Memcache basis) and update PHPDoc accordingly.
Remove methods held over from original Memcache plugin, but that aren…
…'t part of Core's object cache implementation.

While some do have equivalents in Redis, others don't. For now, aim for something streamlined and the extras can come later.
Implement `increment()` and `decrement()` methods for the correspondi…
…ng `wp_cache_incr()` and `wp_cache_decr()` functions.
Remove `wp_cache_increment()` and `wp_cache_decrement()` as they aren…
…'t part of Core's implementation.

Users switching between cache backends shouldn't have to worry about function names changing. That's not how Core's object cache is designed.
Add handling for the various responses Predis returns after performin…
…g an action, ensuring a boolean always results.
Improve behaviour when Redis is unavailable
* Catches connection exceptions rather than triggering fatals
* Forces all cache lookups to use the internal cache when Redis is unavailable

This comment has been minimized.

Copy link
Contributor Author

commented Mar 4, 2014

Also, as you may note in the readme, I changed the name. Thinking ahead to dotorg submission, we can't use "WordPress" in the name. :)


This comment has been minimized.

Copy link
Contributor Author

commented Mar 6, 2014

bd44ddf and 0960f72 add support for wp_cache_get_multi(). Though not part of the default object caching suite in Core, the Memcached Object Cache plugin introduced the function and it has been adopted in some plugins. Since Redis supports getting multiple keys (mget), there didn't seem a good reason not to implement this method.

ericmann added a commit that referenced this pull request Mar 7, 2014

Merge pull request #9 from ethitter/master
Fully working implementation

@ericmann ericmann merged commit 0b956a3 into ericmann:master Mar 7, 2014

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.