i am working on Redis to store data Everything is working fine in my local system. i have successfully installed redis also in laravel with this command composer require predis/predis also and Redis setup of window also installed. Now when i store data in Redis like this:-
Redis::set('first',"My first Test"); // put data in Redis key
echo Redis ::get('first'); // get data
Above code is working fine in my local system. when i try to use this code in live server it is showing the below error:- Please help me to resolve this issue. We are using amazon-ec2 server Thanks in advance :)
I had the same issue. But I believe its related to php 7 rather than Larevel 5.4 because I'm using Laravel 5.1 and I still have the problem.
I came across 2 solutions
use Illuminate\Support\Facades\Redis;
instead of use Redis;
if you want to call the Redis methods statically.$redis = new Redis();
$redis->set('boo','Have beer and relax!')
$redis->get('boo');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With