diff options
author | Florian Pritz <bluewind@xinu.at> | 2013-11-09 22:18:51 +0100 |
---|---|---|
committer | Florian Pritz <bluewind@xinu.at> | 2013-11-09 22:31:46 +0100 |
commit | 4a92fbad4beb9d27f4bbfa4f9360bddf455e671f (patch) | |
tree | b7487a1c46331187fc1d04ed7e3681d7c17977ab /application/models | |
parent | 389d2aeb62ff8755691392953ae2044b7fad5ada (diff) |
use cache_function() everywhere
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'application/models')
-rw-r--r-- | application/models/mfile.php | 9 |
1 files changed, 3 insertions, 6 deletions
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) |