Separate out some common code

This commit is contained in:
Craig Andrews 2009-12-04 23:17:19 -05:00
parent fa66755508
commit f4fc8481e2
1 changed files with 4 additions and 2 deletions

View File

@ -33,6 +33,7 @@ class MinifyAction extends Action
const cacheKey = 'minify'; const cacheKey = 'minify';
var $file; var $file;
var $v;
function isReadOnly($args) function isReadOnly($args)
{ {
@ -80,13 +81,14 @@ class MinifyAction extends Action
$c = common_memcache(); $c = common_memcache();
if (!empty($c)) { if (!empty($c)) {
$out = $c->get(common_cache_key(self::cacheKey . ':' . $this->file)); $cacheKey = common_cache_key(self::cacheKey . ':' . $this->file . '?v=' . empty($this->v)?'':$this->v);
$out = $c->get($cacheKey);
} }
if(empty($out)) { if(empty($out)) {
$out = $this->minify($this->file); $out = $this->minify($this->file);
} }
if (!empty($c)) { if (!empty($c)) {
$c->set(common_cache_key(self::cacheKey . ':' . $this->file), $out); $c->set($cacheKey, $out);
} }
$sec = session_cache_expire() * 60; $sec = session_cache_expire() * 60;