Skip to content

Commit

Permalink
Merge pull request #107 from renoki-co/fix/cacheTime
Browse files Browse the repository at this point in the history
[fix] cacheTime naming mismatch causing cache to not fill in
  • Loading branch information
rennokki authored Dec 7, 2021
2 parents 7600f49 + 5095ad3 commit 24d6aec
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/Traits/QueryCacheModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ trait QueryCacheModule
*
* @var int|\DateTime
*/
protected $cacheTime;
protected $cacheFor;

/**
* The tags for the query cache. Can be useful
Expand Down Expand Up @@ -78,7 +78,7 @@ public function getFromQueryCache(string $method = 'get', array $columns = ['*']
$key = $this->getCacheKey($method);
$cache = $this->getCache();
$callback = $this->getQueryCacheCallback($method, $columns, $id);
$time = $this->getCacheTime();
$time = $this->getCacheFor();

if ($time instanceof DateTime || $time > 0) {
return $cache->remember($key, $time, $callback);
Expand Down Expand Up @@ -209,7 +209,7 @@ public function flushQueryCacheWithTag(string $tag): bool
*/
public function cacheFor($time)
{
$this->cacheTime = $time;
$this->cacheFor = $time;
$this->avoidCache = $time === null;

return $this;
Expand Down Expand Up @@ -385,9 +385,9 @@ public function shouldUsePlainKey(): bool
*
* @return int|\DateTime
*/
public function getCacheTime()
public function getCacheFor()
{
return $this->cacheTime;
return $this->cacheFor;
}

/**
Expand Down

0 comments on commit 24d6aec

Please sign in to comment.