首页 > 代码库 > laravel redis存数组并设置过期时间

laravel redis存数组并设置过期时间

            $data = [
                ‘zoneList‘=>$zoneList,
                ‘eqList‘ => $eqList,
                ‘mdateList‘ => $mdateList,
                ‘workhoursList‘ => $workhoursList,
                ‘pricerangeList‘ => $pricerangeList,
            ];

            Redis::set($cacheKey, serialize($data));
            Redis::expire($cacheKey, 300);

laravel门面set数组需要先把数组序列化,

设置过期时间通过方法expire, 

laravel redis存数组并设置过期时间