fix caching time

This commit is contained in:
Joshua Seigler 2016-07-01 18:18:55 -04:00
parent 1bc4c247d1
commit 46764e6879
2 changed files with 4 additions and 4 deletions

View file

@ -27,7 +27,7 @@ $router->map( 'GET', '/charts/[dark|light:theme]/[a:curA]-[btc:curB]/[a:duration
$duration, $duration,
$format, $format,
800, 800,
200, 250,
12 12
); );
}); });

View file

@ -82,7 +82,7 @@ function renderChart(
if(is_null($poloniexJson)) { if(is_null($poloniexJson)) {
$poloniexJson = getJson($poloniexUrl); $poloniexJson = getJson($poloniexUrl);
// Write to cache for next time // Write to cache for next time
CacheManager::set('poloniex-json-'.$pair.'-'.$dataDuration, $poloniexJson, $dataDuration); CacheManager::set('poloniex-json-'.$pair.'-'.$dataDuration, $poloniexJson, $dataResolution);
} }
$chartData = []; $chartData = [];
@ -111,10 +111,10 @@ function renderChart(
$im->destroy(); $im->destroy();
} }
CacheManager::set($chartCacheKey, $result); CacheManager::set($chartCacheKey, $result);
$resultExpires = time() + $dataDuration; $resultExpires = time() + $dataResolution;
} else { } else {
$resultExpires = CacheManager::getInfo($chartCacheKey)[ 'expired_time' ]; $resultExpires = CacheManager::getInfo($chartCacheKey)[ 'expired_time' ];
$startTime = $resultExpires - $dataDuration; $startTime = $resultExpires - $dataResolution;
} }
header('Expires: '.gmdate('D, d M Y H:i:s', $resultExpires)); header('Expires: '.gmdate('D, d M Y H:i:s', $resultExpires));