Skip to content

Commit

Permalink
Small update to v1.2.
Browse files Browse the repository at this point in the history
  • Loading branch information
gilbitron committed Nov 6, 2010
1 parent 4df226e commit 2c4bac5
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions simpleCache.php
@@ -1,5 +1,5 @@
<?php <?php
/* SimpleCache v1.1 /* SimpleCache v1.2
* May 2010 * May 2010
* Gilbert Pellegrom * Gilbert Pellegrom
* http://gilbertpellegrom.co.uk * http://gilbertpellegrom.co.uk
Expand Down Expand Up @@ -34,10 +34,9 @@ function set_cache($label, $data)


function get_cache($label) function get_cache($label)
{ {
$filename = $this->cache_path . $this->safe_filename($label) .'.cache'; if($this->is_cached($label))

if(file_exists($filename) && (filemtime($filename) + $this->cache_time >= time()))
{ {
$filename = $this->cache_path . $this->safe_filename($label) .'.cache';
return file_get_contents($filename); return file_get_contents($filename);
} }


Expand Down

0 comments on commit 2c4bac5

Please sign in to comment.