@@ -17,33 +17,33 @@ discard block |
||
| 17 | 17 | $key = $instance->makeCacheKey(); |
| 18 | 18 | |
| 19 | 19 | return $instance->cache($tags) |
| 20 | - ->rememberForever($key, function () use ($columns) { |
|
| 20 | + ->rememberForever($key, function() use ($columns) { |
|
| 21 | 21 | return parent::all($columns); |
| 22 | 22 | }); |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | public static function bootCachable() |
| 26 | 26 | { |
| 27 | - static::saved(function ($instance) { |
|
| 27 | + static::saved(function($instance) { |
|
| 28 | 28 | $instance->checkCooldownAndFlushAfterPersiting($instance); |
| 29 | 29 | }); |
| 30 | 30 | |
| 31 | - static::pivotAttached(function ($instance) { |
|
| 31 | + static::pivotAttached(function($instance) { |
|
| 32 | 32 | $instance->checkCooldownAndFlushAfterPersiting($instance); |
| 33 | 33 | }); |
| 34 | 34 | |
| 35 | - static::pivotDetached(function ($instance) { |
|
| 35 | + static::pivotDetached(function($instance) { |
|
| 36 | 36 | $instance->checkCooldownAndFlushAfterPersiting($instance); |
| 37 | 37 | }); |
| 38 | 38 | |
| 39 | - static::pivotUpdated(function ($instance) { |
|
| 39 | + static::pivotUpdated(function($instance) { |
|
| 40 | 40 | $instance->checkCooldownAndFlushAfterPersiting($instance); |
| 41 | 41 | }); |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | public function newEloquentBuilder($query) |
| 45 | 45 | { |
| 46 | - if (! $this->isCachable()) { |
|
| 46 | + if (!$this->isCachable()) { |
|
| 47 | 47 | $this->isCachable = true; |
| 48 | 48 | |
| 49 | 49 | return new EloquentBuilder($query); |
@@ -61,13 +61,13 @@ discard block |
||
| 61 | 61 | $cacheKey = "{$cachePrefix}:{$modelClassName}-cooldown:seconds"; |
| 62 | 62 | |
| 63 | 63 | $this->cache() |
| 64 | - ->rememberForever($cacheKey, function () use ($seconds) { |
|
| 64 | + ->rememberForever($cacheKey, function() use ($seconds) { |
|
| 65 | 65 | return $seconds; |
| 66 | 66 | }); |
| 67 | 67 | |
| 68 | 68 | $cacheKey = "{$cachePrefix}:{$modelClassName}-cooldown:invalidated-at"; |
| 69 | 69 | $this->cache() |
| 70 | - ->rememberForever($cacheKey, function () { |
|
| 70 | + ->rememberForever($cacheKey, function() { |
|
| 71 | 71 | return now(); |
| 72 | 72 | }); |
| 73 | 73 | |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | $cacheKey = "{$cachePrefix}:{$modelClassName}-cooldown:saved-at"; |
| 49 | 49 | |
| 50 | 50 | $this->cache() |
| 51 | - ->rememberForever($cacheKey, function () { |
|
| 51 | + ->rememberForever($cacheKey, function() { |
|
| 52 | 52 | return now(); |
| 53 | 53 | }); |
| 54 | 54 | } |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | { |
| 59 | 59 | return "genealabs:laravel-model-caching:" |
| 60 | 60 | . (config('laravel-model-caching.cache-prefix') |
| 61 | - ? config('laravel-model-caching.cache-prefix', '') . ":" |
|
| 61 | + ? config('laravel-model-caching.cache-prefix', '').":" |
|
| 62 | 62 | : ""); |
| 63 | 63 | } |
| 64 | 64 | |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | [$cacheCooldown, $invalidatedAt, $savedAt] = $this |
| 91 | 91 | ->getCacheCooldownDetails($instance, $cachePrefix, $modelClassName); |
| 92 | 92 | |
| 93 | - if (! $cacheCooldown || $cacheCooldown === 0) { |
|
| 93 | + if (!$cacheCooldown || $cacheCooldown === 0) { |
|
| 94 | 94 | return [null, null, null]; |
| 95 | 95 | } |
| 96 | 96 | |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | { |
| 124 | 124 | [$cacheCooldown, $invalidatedAt] = $this->getModelCacheCooldown($instance); |
| 125 | 125 | |
| 126 | - if (! $cacheCooldown |
|
| 126 | + if (!$cacheCooldown |
|
| 127 | 127 | || now()->diffInSeconds($invalidatedAt) < $cacheCooldown |
| 128 | 128 | ) { |
| 129 | 129 | return; |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | { |
| 149 | 149 | [$cacheCooldown, $invalidatedAt] = $instance->getModelCacheCooldown($instance); |
| 150 | 150 | |
| 151 | - if (! $cacheCooldown) { |
|
| 151 | + if (!$cacheCooldown) { |
|
| 152 | 152 | $instance->flushCache(); |
| 153 | 153 | |
| 154 | 154 | return; |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | public function isCachable() : bool |
| 165 | 165 | { |
| 166 | 166 | return $this->isCachable |
| 167 | - && ! config('laravel-model-caching.disabled'); |
|
| 167 | + && !config('laravel-model-caching.disabled'); |
|
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 | protected function setCacheCooldownSavedAtTimestamp(Model $instance) |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | $cacheKey = "{$cachePrefix}:{$modelClassName}-cooldown:saved-at"; |
| 175 | 175 | |
| 176 | 176 | $instance->cache() |
| 177 | - ->rememberForever($cacheKey, function () { |
|
| 177 | + ->rememberForever($cacheKey, function() { |
|
| 178 | 178 | return now(); |
| 179 | 179 | }); |
| 180 | 180 | } |