1. 程式人生 > >laravel redis存數組並設置過期時間

laravel redis存數組並設置過期時間

spa class 過期 data work slist 序列化 通過 ria

            $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存數組並設置過期時間