Giter VIP home page Giter VIP logo

wp-redis-predis-client's Introduction

WP Redis - Predis Client
An alternative Redis client for use with WP Redis. Enables TLS connections.
Build status Codecov
A Human Made project. Maintained by @nathanielks.

WP Redis - Predis Client

This is a package that enables the use of Predis as a Redis Client as opposed to PHPRedis for 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_onceing 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 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. Predis also takes an additional argument, ssl, for configuring TLS connections. See PHP's SSL Context options for more details.

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,
    ),
);

wp-redis-predis-client's People

Contributors

danielbachhuber avatar jazzsequence avatar joehoyle avatar kovshenin avatar nathanielks avatar roborourke avatar tangrufus avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

wp-redis-predis-client's Issues

Problems with redeclaring functions

I don't use Composer in my Application. To be honest, I never used it before. But it seems that you require the usage to build the needed folder-structure. Otherwise it throws a fatal error because "Vendor/autoloader.php" is not available, Predis\Client class is unavailable and so on.

The problem is, that I need to require_once your "functions.php" file, otherwise the functions in the "object-cache.php" are not available.

But when it do this inside the "wp-config.php" then it throws the following error-messages:

Fatal error: Cannot redeclare WP_Predis\add_filters() (previously declared in /path-to/wp-content/plugins/wp-redis-predis-client-master/functions.php:13) in /path-to/wp-content/plugins/wp-redis-predis-client-master/functions.php on line 13

I'm a bit confused, because I use require_once inside the wp-config. So it shouldn't load this file again.

Any idea why this happens and how to fix it?

Add PHP 8.0 support

Currently the tests are failing for PHP 8.0 due to the following:

Warning: PHP Startup: Unable to load dynamic library 'redis.so'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.