I am trying to cache an array, but for some reason, nothing is added. This is the code:
public static function getEmployees()
    {
        if(!Cache::has('employees')):
            $data      = ['urlPath' => '/employees/directory'];
            $params    = ['fields' => 'jobTitle'];
            $employees = API::callAPI('GET', $data, $params);
            Cache::putMany($employees, 1440);
        endif;
        return Cache::get('employees');
    }
And whey I try to get cached value (array), I am getting null:
dd(Cache::get('employees'));
And this is an array I want to store:
array:2 [▼
  "fields" => array:16 [▶]
  "employees" => array:257 [▶]
]
(I am using db for storing)
via Chebli Mohamed
 
Aucun commentaire:
Enregistrer un commentaire