I am trying to cache data in Redis but getting following error:
ErrorException: strlen() expects parameter 1 to be string, array given /home/mktplacemiddleware/demo/vendor/predis/predis/src/Connection/StreamConnection.php:390
Following is the code i am trying:
Redis::set('CacheTest', $finalProduct); //$finalProduct is an Array
I am using:
Any help will be appreciated. Thanks
You need to store a data in serialize or json try like this:
Redis::set('CacheTest', json_encode($finalProduct)); //$finalProduct is an Array
and get value you need to decode value
$data = Redis::get('CacheTest');
dd(json_decode($data))