File tree Expand file tree Collapse file tree 3 files changed +7
-21
lines changed
Expand file tree Collapse file tree 3 files changed +7
-21
lines changed Original file line number Diff line number Diff line change @@ -92,16 +92,10 @@ $bob = Kid::whereName('Bob')->cacheFor(60)->cacheTags(['kids'])->first();
9292
9393### Global Cache Invalidation
9494
95- To invalidate all the cache for a specific model, use the ` flushAllQueryCache ` method.
95+ To invalidate all the cache for a specific model, use the ` flushQueryCache ` method without any additional parameter .
9696
9797The package automatically appends a list of tags, called ** base tags** on each query coming from a model. It defaults to the full model class name.
9898
99- You can still use your custom tags on the queries and they will work like usual:
100-
101- ``` php
102- Kid::flushAllQueryCache();
103- ```
104-
10599In case you want to change the base tags, you can do so in your model.
106100
107101``` php
@@ -124,7 +118,7 @@ class Kid extends Model
124118}
125119
126120// Automatically works with `custom_tag`
127- Kid::flushAllQueryCache ();
121+ Kid::flushQueryCache ();
128122```
129123
130124## Relationship Caching
Original file line number Diff line number Diff line change @@ -171,25 +171,17 @@ public function flushQueryCache(array $tags = []): bool
171171 return false ;
172172 }
173173
174+ if (! $ tags ) {
175+ $ tags = $ this ->getCacheBaseTags ();
176+ }
177+
174178 foreach ($ tags as $ tag ) {
175179 self ::flushQueryCacheWithTag ($ tag );
176180 }
177181
178182 return true ;
179183 }
180184
181- /**
182- * Flush all cached resources with the default model tag.
183- *
184- * @return bool
185- */
186- public function flushAllQueryCache (): bool
187- {
188- return self ::flushQueryCache (
189- $ this ->getCacheBaseTags () ?: []
190- );
191- }
192-
193185 /**
194186 * Flush the cache for a specific tag.
195187 *
Original file line number Diff line number Diff line change @@ -98,7 +98,7 @@ public function test_cache_flush_with_default_tags_attached()
9898 $ cache = Cache::tags (['test ' , Book::getCacheBaseTags ()[0 ]])->get ('leqc:sqlitegetselect * from "books" limit 1a:0:{} ' );
9999 $ this ->assertNotNull ($ cache );
100100
101- Book::flushAllQueryCache ();
101+ Book::flushQueryCache ();
102102
103103 $ cache = Cache::tags (['test ' , Book::getCacheBaseTags ()[0 ]])->get ('leqc:sqlitegetselect * from "books" limit 1a:0:{} ' );
104104
You can’t perform that action at this time.
0 commit comments