From 4a92fbad4beb9d27f4bbfa4f9360bddf455e671f Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Sat, 9 Nov 2013 22:18:51 +0100 Subject: use cache_function() everywhere Signed-off-by: Florian Pritz --- application/models/mfile.php | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'application/models') diff --git a/application/models/mfile.php b/application/models/mfile.php index e70b5c812..d7e301b1e 100644 --- a/application/models/mfile.php +++ b/application/models/mfile.php @@ -339,8 +339,7 @@ class Mfile extends CI_Model { } public function get_lexers() { - $this->load->driver('cache', array('adapter' => $this->config->item("cache_backend"))); - if (! $lexers = $this->cache->get('lexers')) { + return cache_function('lexers', 1800, function() { $lexers = array(); $last_desc = ""; exec("python ".escapeshellarg(FCPATH."scripts/get_lexer_list.py"), $output); @@ -354,10 +353,8 @@ class Mfile extends CI_Model { $lexers[$name] = $desc; } $lexers["text"] = "Plain text"; - $this->cache->save('lexers', $lexers, 1800); - } - - return $lexers; + return $lexers; + }); } public function should_highlight($type) -- cgit v1.2.3-24-g4f1b