Skip to content

Commit

Permalink
Add purge each cache with trace
Browse files Browse the repository at this point in the history
  • Loading branch information
HillLiu committed Jun 22, 2018
1 parent 39a54c3 commit bf8e157
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/_cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use LengthException;
use PMVC\ListIterator;
use PMVC\PlugIn\curl\CurlHelper;
use PMVC\PlugIn\curl\CurlResponder;

${_INIT_CONFIG}[_CLASS] = __NAMESPACE__.'\cache';

Expand Down Expand Up @@ -83,7 +84,8 @@ public function process($curlRequest, $more, $ttl)
*/
function() use ($r) {
$r->purge();
}, 'purge-'.$r->dbCompositeKey);
return ['Clean-Cache'=>$r->hash];
}, 'purge-'.$r->hash);

\PMVC\dev(
/**
Expand Down Expand Up @@ -160,11 +162,10 @@ private function _getHash($maybeCurl)
public function getCache($maybeHash)
{
$hash = $this->_getHash($maybeHash);
$r = \PMVC\fromJson($this->_db[$hash]);
$r = CurlResponder::fromJson($this->_db[$hash]);
if (!$r) {
return false;
}
$r->body = gzuncompress(urldecode($r->body));
$r->expire = $this->_db->ttl($hash);
$r->hash = $hash;
$r->purge = $this->getPurge($hash);
Expand Down

0 comments on commit bf8e157

Please sign in to comment.