File tree Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
4
4
The format is based on [ Keep a Changelog] ( http://keepachangelog.com/en/1.0.0/ )
5
5
and this project adheres to [ Semantic Versioning] ( http://semver.org/spec/v2.0.0.html ) .
6
6
7
+ ## [ 0.2.35] - 21 Feb 2018
8
+ ### Fixed
9
+ - cache key generation for ` find() ` and ` findOrFail() ` .
10
+
7
11
## [ 0.2.33] - 19 Feb 2018
8
12
### Added
9
13
- unit test to make sure ` Model::all() ` returns a collection when only only
Original file line number Diff line number Diff line change @@ -863,4 +863,24 @@ public function testSubsequentFindsReturnDifferentModels()
863
863
$ this ->assertEquals ($ author1 ->id , 1 );
864
864
$ this ->assertEquals ($ author2 ->id , 2 );
865
865
}
866
+
867
+ public function testFindOrFailCachesModels ()
868
+ {
869
+ $ author = (new Author )
870
+ ->findOrFail (1 );
871
+
872
+ $ key = sha1 ('genealabs:laravel-model-caching:genealabslaravelmodelcachingtestsfixturesauthor-find_1 ' );
873
+ $ tags = [
874
+ 'genealabs:laravel-model-caching:genealabslaravelmodelcachingtestsfixturesauthor ' ,
875
+ ];
876
+
877
+ $ cachedResults = $ this ->cache ()
878
+ ->tags ($ tags )
879
+ ->get ($ key )['value ' ];
880
+ $ liveResults = (new UncachedAuthor )
881
+ ->findOrFail (1 );
882
+
883
+ $ this ->assertEquals ($ cachedResults ->toArray (), $ author ->toArray ());
884
+ $ this ->assertEquals ($ liveResults ->toArray (), $ author ->toArray ());
885
+ }
866
886
}
You can’t perform that action at this time.
0 commit comments