I have the below API. CityData.php is a file with city and zip which has a size of 100kb. With this function the interpreter loads the file from disk to memory on each request. How can I avoid this and share it between requests?
<?php
require_once 'Config.php';
class CourseController{
public function getCourseApi()
{
require_once 'CityData.php';
......
}
}
CityData.php
130433 => '馆陶县',
130434 => '魏县',
130435 => '曲周县',
130481 => '武安市',
130500 => '邢台市',
130502 => '桥东区',
........
Mem Cash is a good solution you can load data for one time then it will available in the RAM for how long you want.