我建议使用wordpress transient API.例如.
$transient_name = 'some_api_req_param1';
$transient_value = get_transient($transient_name);
if( false !== $transient_value){
echo $transient_value;
}else{
//$result = ...
//fetch your data here
//in the end save the data in the transient
$expiration_time = 60*60*24*7;//in second
set_transient($transient_name,$result,$expiration_time);
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3005 次 |
| 最近记录: |