File tree 2 files changed +5
-10
lines changed
2 files changed +5
-10
lines changed Original file line number Diff line number Diff line change @@ -20,15 +20,10 @@ protected function cache(array $tags = [])
20
20
return $ cache ;
21
21
}
22
22
23
- protected function getCacheKey (array $ columns = ['* ' ], $ ids = null ) : string
23
+ protected function getCacheKey (array $ columns = ['* ' ], $ idColumn = null ) : string
24
24
{
25
25
$ key = str_slug (get_class ($ this ->model ));
26
-
27
- if ($ ids ) {
28
- $ key .= '_ ' . (is_array ($ ids )
29
- ? implode ('_ ' , $ ids )
30
- : $ ids );
31
- }
26
+ $ key .= $ idColumn ? "_ {$ idColumn }" : '' ;
32
27
33
28
if ($ columns !== ['* ' ]) {
34
29
$ key .= '_ ' . implode ('_ ' , $ columns );
Original file line number Diff line number Diff line change @@ -351,8 +351,8 @@ public function testMinModelResultsCreatesCache()
351
351
public function testPluckModelResultsCreatesCache ()
352
352
{
353
353
$ authors = (new Author )->with ('books ' , 'profile ' )
354
- ->pluck ('id ' );
355
- $ key = 'genealabslaravelmodelcachingtestsfixturesauthor_id -books-profile-pluck_id ' ;
354
+ ->pluck ('name ' , ' id ' );
355
+ $ key = 'genealabslaravelmodelcachingtestsfixturesauthor_name -books-profile-pluck_name_id ' ;
356
356
$ tags = [
357
357
'genealabslaravelmodelcachingtestsfixturesauthor ' ,
358
358
'genealabslaravelmodelcachingtestsfixturesbook ' ,
@@ -362,7 +362,7 @@ public function testPluckModelResultsCreatesCache()
362
362
$ cachedResults = cache ()->tags ($ tags )
363
363
->get ($ key );
364
364
$ liveResults = (new UncachedAuthor )->with ('books ' , 'profile ' )
365
- ->pluck ('id ' );
365
+ ->pluck ('name ' , ' id ' );
366
366
367
367
$ this ->assertEmpty ($ authors ->diffAssoc ($ cachedResults ));
368
368
$ this ->assertEmpty ($ liveResults ->diffAssoc ($ cachedResults ));
You can’t perform that action at this time.
0 commit comments