From 3df96b80065a46c0ca85c11b2a15c29501e15550 Mon Sep 17 00:00:00 2001 From: int2001 Date: Sun, 18 Feb 2024 07:44:03 +0000 Subject: [PATCH] Cache DXped-Sources for 12h --- application/controllers/Dxcalendar.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/application/controllers/Dxcalendar.php b/application/controllers/Dxcalendar.php index a188ee6a7..9bfc720ae 100644 --- a/application/controllers/Dxcalendar.php +++ b/application/controllers/Dxcalendar.php @@ -9,8 +9,13 @@ class Dxcalendar extends CI_Controller { $data['page_title'] = "DX Calendar"; - $url = 'http://www.ng3k.com/adxo.xml'; - $rssdata = simplexml_load_file($url, null, LIBXML_NOCDATA); + $this->load->driver('cache', array('adapter' => 'file', 'backup' => 'file')); + $rssUrl = 'http://www.ng3k.com/adxo.xml'; + if (!$rssRawData = $this->cache->get('RssRawDxCal')) { + $rssRawData = file_get_contents($rssUrl, true); + $this->cache->save('RssRawDxCal', $rssRawData, (60*12)); + } + $rssdata = simplexml_load_string($rssRawData, null, LIBXML_NOCDATA); // Get Date format if($this->session->userdata('user_date_format')) {