https://github.com/humanmade/wp-redis-predis-client
An alternative Redis client for use with WP Redis. Enables TLS connections.
https://github.com/humanmade/wp-redis-predis-client
cache predis redis wordpress wp-redis
Last synced: 7 months ago
JSON representation
An alternative Redis client for use with WP Redis. Enables TLS connections.
- Host: GitHub
- URL: https://github.com/humanmade/wp-redis-predis-client
- Owner: humanmade
- Created: 2017-08-16T03:07:39.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2025-01-24T17:09:27.000Z (about 1 year ago)
- Last Synced: 2025-06-22T17:10:04.373Z (7 months ago)
- Topics: cache, predis, redis, wordpress, wp-redis
- Language: PHP
- Homepage:
- Size: 87.9 KB
- Stars: 28
- Watchers: 24
- Forks: 6
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
WP Redis - Predis Client
An alternative Redis client for use with WP Redis. Enables TLS connections.
A Human Made project. Maintained by @nathanielks.
# WP Redis - Predis Client
This is a package that enables the use of [Predis](https://github.com/nrk/predis/) as a Redis Client as opposed to PHPRedis for [WP Redis](https://github.com/pantheon-systems/wp-redis/). Predis has the distinct advantage of connecting to Redis via TLS, encrypting traffic in-transit. Requires WP Redis >= 0.7.0.
## Getting Started
### Requiring Files
#### Composer
When using Composer, `functions.php` file will automatically be loaded whenever you include Composer's autoloader in your project.
#### Manually Requiring
The only file needing `require_once`ing for WP Predis to work correctly is `functions.php` (which is automatically included via `vendor/autoload.php`, which is generated by Composer). Download this repo somewhere in your project, run `composer install`, and include `vendor/autoload.php` somewhere early (such as `wp-config.php`):
```
require_once '/path/to/wp-redis-predis-client/vendor/autoload.php';
```
### Object Cache stub
Now that files have been included, it's recommended you use the included [`object-cache.php`](object-cache.php) file instead of the one included with WP Redis. It will add the required filters for WP Predis to work and then include WP Redis' `object-cache.php` file. Once `object-cache.php` is in `wp-content` (or whatever content directory you are using), you're good to go!
### Configuring Predis
WP Redis - Predis Client adheres to WP Redis' [configuration details](https://github.com/pantheon-systems/wp-redis#installation). Predis also takes an additional argument, `ssl`, for configuring TLS connections. See PHP's [SSL Context options](http://php.net/manual/en/context.ssl.php) for more details.
```php
global $redis_server;
$redis_server = array(
'host' => '127.0.0.1',
'port' => 6379,
'ssl' => array(
'local_cert' => '/path/to/certificate_and_key.pem',
'verify_peer' => true,
),
);
```