@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | |
13 | 13 | public function avg($column) |
14 | 14 | { |
15 | - if (! $this->isCachable()) { |
|
15 | + if (!$this->isCachable()) { |
|
16 | 16 | return parent::avg($column); |
17 | 17 | } |
18 | 18 | |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | |
24 | 24 | public function count($columns = ["*"]) |
25 | 25 | { |
26 | - if (! $this->isCachable()) { |
|
26 | + if (!$this->isCachable()) { |
|
27 | 27 | return parent::count($columns); |
28 | 28 | } |
29 | 29 | |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | */ |
46 | 46 | public function find($id, $columns = ["*"]) |
47 | 47 | { |
48 | - if (! $this->isCachable()) { |
|
48 | + if (!$this->isCachable()) { |
|
49 | 49 | return parent::find($id, $columns); |
50 | 50 | } |
51 | 51 | |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | |
57 | 57 | public function first($columns = ["*"]) |
58 | 58 | { |
59 | - if (! $this->isCachable()) { |
|
59 | + if (!$this->isCachable()) { |
|
60 | 60 | return parent::first($columns); |
61 | 61 | } |
62 | 62 | |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | |
68 | 68 | public function get($columns = ["*"]) |
69 | 69 | { |
70 | - if (! $this->isCachable()) { |
|
70 | + if (!$this->isCachable()) { |
|
71 | 71 | return parent::get($columns); |
72 | 72 | } |
73 | 73 | |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | |
79 | 79 | public function max($column) |
80 | 80 | { |
81 | - if (! $this->isCachable()) { |
|
81 | + if (!$this->isCachable()) { |
|
82 | 82 | return parent::max($column); |
83 | 83 | } |
84 | 84 | |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | |
90 | 90 | public function min($column) |
91 | 91 | { |
92 | - if (! $this->isCachable()) { |
|
92 | + if (!$this->isCachable()) { |
|
93 | 93 | return parent::min($column); |
94 | 94 | } |
95 | 95 | |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | $pageName = "page", |
105 | 105 | $page = null |
106 | 106 | ) { |
107 | - if (! $this->isCachable()) { |
|
107 | + if (!$this->isCachable()) { |
|
108 | 108 | return parent::paginate($perPage, $columns, $pageName, $page); |
109 | 109 | } |
110 | 110 | |
@@ -116,11 +116,11 @@ discard block |
||
116 | 116 | |
117 | 117 | public function pluck($column, $key = null) |
118 | 118 | { |
119 | - if (! $this->isCachable()) { |
|
119 | + if (!$this->isCachable()) { |
|
120 | 120 | return parent::pluck($column, $key); |
121 | 121 | } |
122 | 122 | |
123 | - $keyDifferentiator = "-pluck_{$column}" . ($key ? "_{$key}" : ""); |
|
123 | + $keyDifferentiator = "-pluck_{$column}".($key ? "_{$key}" : ""); |
|
124 | 124 | $cacheKey = $this->makeCacheKey([$column], null, $keyDifferentiator); |
125 | 125 | |
126 | 126 | return $this->cachedValue(func_get_args(), $cacheKey); |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | |
129 | 129 | public function sum($column) |
130 | 130 | { |
131 | - if (! $this->isCachable()) { |
|
131 | + if (!$this->isCachable()) { |
|
132 | 132 | return parent::sum($column); |
133 | 133 | } |
134 | 134 | |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | |
140 | 140 | public function value($column) |
141 | 141 | { |
142 | - if (! $this->isCachable()) { |
|
142 | + if (!$this->isCachable()) { |
|
143 | 143 | return parent::value($column); |
144 | 144 | } |
145 | 145 | |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | return $this->cache($cacheTags) |
209 | 209 | ->rememberForever( |
210 | 210 | $hashedCacheKey, |
211 | - function () use ($arguments, $cacheKey, $method) { |
|
211 | + function() use ($arguments, $cacheKey, $method) { |
|
212 | 212 | return [ |
213 | 213 | "key" => $cacheKey, |
214 | 214 | "value" => parent::{$method}(...$arguments), |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | $cacheKey = "{$cachePrefix}:{$modelClassName}-cooldown:saved-at"; |
61 | 61 | |
62 | 62 | $this->cache() |
63 | - ->rememberForever($cacheKey, function () { |
|
63 | + ->rememberForever($cacheKey, function() { |
|
64 | 64 | return now(); |
65 | 65 | }); |
66 | 66 | } |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | { |
71 | 71 | return "genealabs:laravel-model-caching:" |
72 | 72 | . (config('laravel-model-caching.cache-prefix') |
73 | - ? config('laravel-model-caching.cache-prefix', '') . ":" |
|
73 | + ? config('laravel-model-caching.cache-prefix', '').":" |
|
74 | 74 | : ""); |
75 | 75 | } |
76 | 76 | |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | ->cache() |
105 | 105 | ->get("{$cachePrefix}:{$modelClassName}-cooldown:seconds"); |
106 | 106 | |
107 | - if (! $cacheCooldown) { |
|
107 | + if (!$cacheCooldown) { |
|
108 | 108 | return [null, null, null]; |
109 | 109 | } |
110 | 110 | |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | { |
128 | 128 | [$cacheCooldown, $invalidatedAt] = $this->getModelCacheCooldown($instance); |
129 | 129 | |
130 | - if (! $cacheCooldown |
|
130 | + if (!$cacheCooldown |
|
131 | 131 | || now()->diffInSeconds($invalidatedAt) < $cacheCooldown |
132 | 132 | ) { |
133 | 133 | return; |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | { |
153 | 153 | [$cacheCooldown, $invalidatedAt] = $instance->getModelCacheCooldown($instance); |
154 | 154 | |
155 | - if (! $cacheCooldown) { |
|
155 | + if (!$cacheCooldown) { |
|
156 | 156 | $instance->flushCache(); |
157 | 157 | |
158 | 158 | return; |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | $cacheKey = "{$cachePrefix}:{$modelClassName}-cooldown:saved-at"; |
173 | 173 | |
174 | 174 | $instance->cache() |
175 | - ->rememberForever($cacheKey, function () { |
|
175 | + ->rememberForever($cacheKey, function() { |
|
176 | 176 | return now(); |
177 | 177 | }); |
178 | 178 | } |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | public static function bootCachable() |
181 | 181 | { |
182 | 182 | // TODO: add for deleted,updated,etc? |
183 | - static::saved(function ($instance) { |
|
183 | + static::saved(function($instance) { |
|
184 | 184 | $instance->checkCooldownAndFlushAfterPersiting($instance); |
185 | 185 | }); |
186 | 186 | } |
@@ -197,14 +197,14 @@ discard block |
||
197 | 197 | $key = $instance->makeCacheKey(); |
198 | 198 | |
199 | 199 | return $instance->cache($tags) |
200 | - ->rememberForever($key, function () use ($columns) { |
|
200 | + ->rememberForever($key, function() use ($columns) { |
|
201 | 201 | return parent::all($columns); |
202 | 202 | }); |
203 | 203 | } |
204 | 204 | |
205 | 205 | public function newEloquentBuilder($query) |
206 | 206 | { |
207 | - if (! $this->isCachable()) { |
|
207 | + if (!$this->isCachable()) { |
|
208 | 208 | $this->isCachable = true; |
209 | 209 | |
210 | 210 | return new EloquentBuilder($query); |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | public function isCachable() : bool |
217 | 217 | { |
218 | 218 | return $this->isCachable |
219 | - && ! config('laravel-model-caching.disabled'); |
|
219 | + && !config('laravel-model-caching.disabled'); |
|
220 | 220 | } |
221 | 221 | |
222 | 222 | public function scopeWithCacheCooldownSeconds( |
@@ -228,13 +228,13 @@ discard block |
||
228 | 228 | $cacheKey = "{$cachePrefix}:{$modelClassName}-cooldown:seconds"; |
229 | 229 | |
230 | 230 | $this->cache() |
231 | - ->rememberForever($cacheKey, function () use ($seconds) { |
|
231 | + ->rememberForever($cacheKey, function() use ($seconds) { |
|
232 | 232 | return $seconds; |
233 | 233 | }); |
234 | 234 | |
235 | 235 | $cacheKey = "{$cachePrefix}:{$modelClassName}-cooldown:invalidated-at"; |
236 | 236 | $this->cache() |
237 | - ->rememberForever($cacheKey, function () { |
|
237 | + ->rememberForever($cacheKey, function() { |
|
238 | 238 | return now(); |
239 | 239 | }); |
240 | 240 |