Skip to content

Commit 4e6aa3e

Browse files
committed
Merge branch 'feature/refactor-to-trait' into develop
2 parents 32af83a + 3a40713 commit 4e6aa3e

File tree

4 files changed

+32
-5
lines changed

4 files changed

+32
-5
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
55
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
66

7+
## [0.2.25] - 16 Feb 2018
8+
### Fixed
9+
- readme spelling errors (thanks @fridzema!).
10+
11+
## [0.2.24] - 16 Feb 2018
12+
### Fixed
13+
- whereNotIn query caching.
14+
715
## [0.2.23] - 13 Feb 2018
816
### Fixed
917
- whereBetween and value bindings parsing.

README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ I created this package in response to a client project that had complex, nested
1414
forms with many `<select>`'s that resulted in over 700 database queries on one
1515
page. I needed a package that abstracted the caching process out of the model
1616
for me, and one that would let me cache custom queries, as well as cache model
17-
relationships. This package is the attempt to address those requirements.
17+
relationships. This package is an attempt to address those requirements.
1818

1919
## Features
2020
- automatic, self-invalidating relationship (both eager- and lazy-loaded) caching.
@@ -36,7 +36,7 @@ composer require genealabs/laravel-model-caching
3636
If you would like to use a different cache store than the default one used by
3737
your Laravel application, you may do so by setting the `MODEL_CACHE_STORE`
3838
environment variable in your `.env` file to the name of a cache store configured
39-
in `config/cache.php` (you can define any custom cache store base on your
39+
in `config/cache.php` (you can define any custom cache store based on your
4040
specific needs there). For example:
4141
```
4242
MODEL_CACHE_STORE=redis
@@ -99,8 +99,7 @@ In testing this has optimized performance on some pages up to 900%! Most often
9999
you should see somewhere around 100% performance increase.
100100

101101
## Commitment to Quality
102-
During package development I try as best as possible to embrace good design and
103-
development practices to try to ensure that this package is as good as it can
102+
During package development I try as best as possible to embrace good design and development practices, to help ensure that this package is as good as it can
104103
be. My checklist for package development includes:
105104

106105
- ✅ Achieve as close to 100% code coverage as possible using unit tests.

src/CacheKey.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ protected function getQueryColumns(array $columns) : string
9090

9191
protected function getTypeClause($where) : string
9292
{
93-
$type =in_array($where['type'], ['In', 'Null', 'NotNull', 'between'])
93+
$type =in_array($where['type'], ['In', 'NotIn', 'Null', 'NotNull', 'between'])
9494
? strtolower($where['type'])
9595
: strtolower($where['operator']);
9696

tests/Unit/CachedBuilderTest.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -793,4 +793,24 @@ public function testWhereDatesResults()
793793
$this->assertTrue($cachedResults->diffKeys($books)->isEmpty());
794794
$this->assertTrue($liveResults->diffKeys($books)->isEmpty());
795795
}
796+
797+
public function testWhereNotInResults()
798+
{
799+
$books = (new Book)
800+
->whereNotIn('id', [1, 2])
801+
->get();
802+
$key = sha1('genealabslaravelmodelcachingtestsfixturesbook-id_notin_1_2');
803+
$tags = [
804+
'genealabslaravelmodelcachingtestsfixturesbook',
805+
];
806+
807+
$cachedResults = cache()->tags($tags)
808+
->get($key);
809+
$liveResults = (new UncachedAuthor)
810+
->whereNotIn('id', [1, 2])
811+
->get();
812+
813+
$this->assertTrue($cachedResults->diffKeys($books)->isEmpty());
814+
$this->assertTrue($liveResults->diffKeys($books)->isEmpty());
815+
}
796816
}

0 commit comments

Comments
 (0)