File tree Expand file tree Collapse file tree 2 files changed +5
-10
lines changed Expand file tree Collapse file tree 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 = [])
2020 return $ cache ;
2121 }
2222
23- protected function getCacheKey (array $ columns = ['* ' ], $ ids = null ) : string
23+ protected function getCacheKey (array $ columns = ['* ' ], $ idColumn = null ) : string
2424 {
2525 $ 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 }" : '' ;
3227
3328 if ($ columns !== ['* ' ]) {
3429 $ key .= '_ ' . implode ('_ ' , $ columns );
Original file line number Diff line number Diff line change @@ -351,8 +351,8 @@ public function testMinModelResultsCreatesCache()
351351 public function testPluckModelResultsCreatesCache ()
352352 {
353353 $ 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 ' ;
356356 $ tags = [
357357 'genealabslaravelmodelcachingtestsfixturesauthor ' ,
358358 'genealabslaravelmodelcachingtestsfixturesbook ' ,
@@ -362,7 +362,7 @@ public function testPluckModelResultsCreatesCache()
362362 $ cachedResults = cache ()->tags ($ tags )
363363 ->get ($ key );
364364 $ liveResults = (new UncachedAuthor )->with ('books ' , 'profile ' )
365- ->pluck ('id ' );
365+ ->pluck ('name ' , ' id ' );
366366
367367 $ this ->assertEmpty ($ authors ->diffAssoc ($ cachedResults ));
368368 $ this ->assertEmpty ($ liveResults ->diffAssoc ($ cachedResults ));
You can’t perform that action at this time.
0 commit comments