Skip to content

Commit

Permalink
Merge pull request #79 from renoki-co/feature/3.x-cleanup
Browse files Browse the repository at this point in the history
[3.x] Formatting
  • Loading branch information
rennokki authored Jul 17, 2021
2 parents 5ad9752 + 36449d9 commit a253bb0
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
laravel:
- 7.*
- 8.*
prefer:
prefer:
- 'prefer-lowest'
- 'prefer-stable'
include:
Expand Down
2 changes: 1 addition & 1 deletion src/Traits/QueryCacheModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ public function flushQueryCache(array $tags = []): bool
}

foreach ($tags as $tag) {
self::flushQueryCacheWithTag($tag);
$this->flushQueryCacheWithTag($tag);
}

return true;
Expand Down
26 changes: 13 additions & 13 deletions src/Traits/QueryCacheable.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,19 @@ protected static function getFlushQueryCacheObserver()
return FlushQueryCacheObserver::class;
}

/**
* Set the base cache tags that will be present
* on all queries.
*
* @return array
*/
protected function getCacheBaseTags(): array
{
return [
(string) self::class,
];
}

/**
* When invalidating automatically on update, you can specify
* which tags to invalidate.
Expand Down Expand Up @@ -96,17 +109,4 @@ protected function newBaseQueryBuilder()

return $builder->cacheBaseTags($this->getCacheBaseTags());
}

/**
* Set the base cache tags that will be present
* on all queries.
*
* @return array
*/
protected function getCacheBaseTags(): array
{
return [
(string) self::class,
];
}
}
1 change: 1 addition & 0 deletions tests/MethodsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ public function test_multiple_append_cache_tags()
public function test_append_cache_tags_with_sub_query()
{
$user = factory(User::class)->create();

factory(Post::class)->createMany([
['user_id' => $user->id, 'name' => 'Post 1 on topic 1'],
['user_id' => $user->id, 'name' => 'Post 2 on topic 1'],
Expand Down
4 changes: 2 additions & 2 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function getEnvironmentSetUp($app)
$app['config']->set('database.default', 'sqlite');
$app['config']->set('database.connections.sqlite', [
'driver' => 'sqlite',
'database' => __DIR__.'/database.sqlite',
'database' => __DIR__.'/database/database.sqlite',
'prefix' => '',
]);
$app['config']->set(
Expand All @@ -64,7 +64,7 @@ public function getEnvironmentSetUp($app)
*/
protected function resetDatabase()
{
file_put_contents(__DIR__.'/database.sqlite', null);
file_put_contents(__DIR__.'/database/database.sqlite', null);
}

/**
Expand Down

0 comments on commit a253bb0

Please sign in to comment.