From ff6f51bdfae206f348dfa5471c2d2be8c6a41d3e Mon Sep 17 00:00:00 2001 From: jonasva Date: Fri, 13 Mar 2015 11:25:54 +0800 Subject: [PATCH] Determine cache name based on formatted date --- src/AnalyticsReports.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/AnalyticsReports.php b/src/AnalyticsReports.php index 703b93c..9b9425c 100644 --- a/src/AnalyticsReports.php +++ b/src/AnalyticsReports.php @@ -260,12 +260,14 @@ public function getSiteIdByUrl($url) */ public function performQuery($startDate, $endDate, $metrics, $others = array()) { - $cacheName = $this->determineCacheName(func_get_args()); + $startDate = $startDate->format('Y-m-d'); + $endDate = $endDate->format('Y-m-d'); + $cacheName = $this->determineCacheName(array($startDate, $endDate, $metrics, $others)); if ($this->useCache() AND Cache::has($cacheName)) { $answer = Cache::get($cacheName); } else { - $answer = $this->client->query($this->siteId, $startDate->format('Y-m-d'), $endDate->format('Y-m-d'), $metrics, $others); + $answer = $this->client->query($this->siteId, $startDate, $endDate, $metrics, $others); if ($this->useCache()) { Cache::put($cacheName, $answer, $this->cacheLifeTimeInMinutes); }