mirror of
https://github.com/seigler/cryptohistory.org
synced 2025-07-27 09:46:10 +00:00
fix caching time
This commit is contained in:
parent
1bc4c247d1
commit
46764e6879
2 changed files with 4 additions and 4 deletions
|
@ -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
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
@ -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));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue