0

I am trying to set a connection to redis using phpfastcache but I keep getting connection refuse

Here is my simple code:

        $defaultDriver = 'Redis';
        $Psr16Adapter = new Psr16Adapter($defaultDriver);

        if(!$Psr16Adapter->has('foo'))
        {
            $Psr16Adapter->set('foo', 'test', 300);
        }
        else
        {
            $data = $Psr16Adapter->get('foo');
        }

now what I am exactly getting is:

Message: Redis failed to connect with the following error message: "Connection refused" line 77 in /var/www/html/vendor/phpfastcache/phpfastcache/lib/Phpfastcache/Drivers/Redis/Driver.php

Filename: /var/www/html/vendor/phpfastcache/phpfastcache/lib/Phpfastcache/Core/Pool/DriverBaseTrait.php

Line Number: 76

2 Answers 2

0

So by default when using phpfastcache it connects to the host = "127.0.0.1" but if you use docker you have to change it to the host name of that container in order to work properly.

Sign up to request clarification or add additional context in comments.

Comments

0

Please check that the default host and port provided in lib/Phpfastcache/Drivers/Redis/Config.php are the same than your Redis server.

You may also need to use Unix socket instead of standard connection.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.