-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Better handling when Redis is enabled, but unavailable or gone away #18
Conversation
* Remove the `WP_Redis` class. Because we're wrapping calls to Redis internally, we don't need a mock equivalent of the `Redis` class. * Distinguish error message between Redis not installed and Redis unavailable.
} | ||
} else { | ||
class WP_Redis { | ||
protected function _call_redis( $method ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not a huge fan of prefixing methods with _
, but the pattern is already established with _exists
`_call_redis()` checks our `is_redis_connected` class variable, which is set to false. We don't need the safety fallback here
Redis can go away on occasion. We want to make sure the relationship doesn't completely end.
$this->blog_prefix = $this->multisite ? $blog_id . ':' : ''; | ||
if ( ! class_exists( 'Redis' ) ) { | ||
$this->is_redis_connected = false; | ||
$this->missing_redis_message = 'Alert! PHPRedis module is unavailable, which is required by WP Redis object cache.'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@joshkoenig How do you feel about the language in this string?
@@ -769,18 +782,54 @@ public function __call( $name, $arguments ) { | |||
case 'exists': | |||
return false; | |||
} | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would still be super-helpful to be able to (optionally) log failures here. i.e. https://github.com/pantheon-systems/wp-redis/pull/5/files#diff-5a2b681f0d32956de83215ea32388177R755
Language looks good to me. |
…back Better handling when Redis is enabled, but unavailable or gone away
Please consider that logging will likely be necessary in the event of Redis server failures: #18 (comment) |
WP_Redis
class. Because we're wrapping calls to Redisinternally, we don't need a mock equivalent of the
Redis
class.unavailable.
See #4, #8, #9