I have two functions that look almost the same and are called on the right one after the other as AJAX requests from a JavaScript function.
public function getAirports(){
if(Cache::has('airports')){
return Cache::get('airports');
}
$airportModel = new Airport;
$airports = json_encode($airportModel -> _getForAutocomplete('iata_faa_code'));
Cache::put('airports', $airports, 600);
return $airports;
}
public function getCountries(){
if(Cache::has('countries')){
return Cache::get('countries');
}
$countryModel = new Country;
$countries = json_encode($countryModel -> _getForAutocomplete('two_letter_code'));
Cache::put('countries', $countries, 600);
return $countries;
}
Now, when I first go to the page, I get the data correctly (since it is not cached yet). If I go to the page a second time, I get countries, but for airports I get the following error and donβt understand why.
{"error":{"type":"Illuminate\\Encryption\\DecryptException","message":"Invalid data.","file":"C:\\xampp\\htdocs\\laravel\\vendor\\laravel\\framework\\src\\Illuminate\\Encryption\\Encrypter.php","line":132}}
I found out that he had to do something with the Googling cache and deleting the Cache part. I would be very happy if someone could help me with this.
By the way, I use the database as a cache driver.
Regards, Marcel
source
share