@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | $cacheKey = "{$cachePrefix}:{$modelClassName}-cooldown:saved-at"; |
| 50 | 50 | |
| 51 | 51 | $this->cache() |
| 52 | - ->rememberForever($cacheKey, function () { |
|
| 52 | + ->rememberForever($cacheKey, function() { |
|
| 53 | 53 | return (new Carbon)->now(); |
| 54 | 54 | }); |
| 55 | 55 | } |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | { |
| 60 | 60 | return "genealabs:laravel-model-caching:" |
| 61 | 61 | . (config('laravel-model-caching.cache-prefix') |
| 62 | - ? config('laravel-model-caching.cache-prefix', '') . ":" |
|
| 62 | + ? config('laravel-model-caching.cache-prefix', '').":" |
|
| 63 | 63 | : ""); |
| 64 | 64 | } |
| 65 | 65 | |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | [$cacheCooldown, $invalidatedAt, $savedAt] = $this |
| 96 | 96 | ->getCacheCooldownDetails($instance, $cachePrefix, $modelClassName); |
| 97 | 97 | |
| 98 | - if (! $cacheCooldown || $cacheCooldown === 0) { |
|
| 98 | + if (!$cacheCooldown || $cacheCooldown === 0) { |
|
| 99 | 99 | return [null, null, null]; |
| 100 | 100 | } |
| 101 | 101 | |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | { |
| 129 | 129 | [$cacheCooldown, $invalidatedAt] = $this->getModelCacheCooldown($instance); |
| 130 | 130 | |
| 131 | - if (! $cacheCooldown |
|
| 131 | + if (!$cacheCooldown |
|
| 132 | 132 | || (new Carbon)->now()->diffInSeconds($invalidatedAt) < $cacheCooldown |
| 133 | 133 | ) { |
| 134 | 134 | return; |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | { |
| 154 | 154 | [$cacheCooldown, $invalidatedAt] = $instance->getModelCacheCooldown($instance); |
| 155 | 155 | |
| 156 | - if (! $cacheCooldown) { |
|
| 156 | + if (!$cacheCooldown) { |
|
| 157 | 157 | $instance->flushCache(); |
| 158 | 158 | |
| 159 | 159 | return; |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | public function isCachable() : bool |
| 170 | 170 | { |
| 171 | 171 | return $this->isCachable |
| 172 | - && ! config('laravel-model-caching.disabled'); |
|
| 172 | + && !config('laravel-model-caching.disabled'); |
|
| 173 | 173 | } |
| 174 | 174 | |
| 175 | 175 | protected function setCacheCooldownSavedAtTimestamp(Model $instance) |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | $cacheKey = "{$cachePrefix}:{$modelClassName}-cooldown:saved-at"; |
| 180 | 180 | |
| 181 | 181 | $instance->cache() |
| 182 | - ->rememberForever($cacheKey, function () { |
|
| 182 | + ->rememberForever($cacheKey, function() { |
|
| 183 | 183 | return (new Carbon)->now(); |
| 184 | 184 | }); |
| 185 | 185 | } |
@@ -18,30 +18,30 @@ discard block |
||
| 18 | 18 | $key = $instance->makeCacheKey(); |
| 19 | 19 | |
| 20 | 20 | return $instance->cache($tags) |
| 21 | - ->rememberForever($key, function () use ($columns) { |
|
| 21 | + ->rememberForever($key, function() use ($columns) { |
|
| 22 | 22 | return parent::all($columns); |
| 23 | 23 | }); |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | public static function bootCachable() |
| 27 | 27 | { |
| 28 | - static::deleted(function ($instance) { |
|
| 28 | + static::deleted(function($instance) { |
|
| 29 | 29 | $instance->checkCooldownAndFlushAfterPersiting($instance); |
| 30 | 30 | }); |
| 31 | 31 | |
| 32 | - static::saved(function ($instance) { |
|
| 32 | + static::saved(function($instance) { |
|
| 33 | 33 | $instance->checkCooldownAndFlushAfterPersiting($instance); |
| 34 | 34 | }); |
| 35 | 35 | |
| 36 | - static::pivotAttached(function ($instance) { |
|
| 36 | + static::pivotAttached(function($instance) { |
|
| 37 | 37 | $instance->checkCooldownAndFlushAfterPersiting($instance); |
| 38 | 38 | }); |
| 39 | 39 | |
| 40 | - static::pivotDetached(function ($instance) { |
|
| 40 | + static::pivotDetached(function($instance) { |
|
| 41 | 41 | $instance->checkCooldownAndFlushAfterPersiting($instance); |
| 42 | 42 | }); |
| 43 | 43 | |
| 44 | - static::pivotUpdated(function ($instance) { |
|
| 44 | + static::pivotUpdated(function($instance) { |
|
| 45 | 45 | $instance->checkCooldownAndFlushAfterPersiting($instance); |
| 46 | 46 | }); |
| 47 | 47 | } |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | |
| 58 | 58 | public function newEloquentBuilder($query) |
| 59 | 59 | { |
| 60 | - if (! $this->isCachable()) { |
|
| 60 | + if (!$this->isCachable()) { |
|
| 61 | 61 | $this->isCachable = true; |
| 62 | 62 | |
| 63 | 63 | return new EloquentBuilder($query); |
@@ -84,13 +84,13 @@ discard block |
||
| 84 | 84 | $cacheKey = "{$cachePrefix}:{$modelClassName}-cooldown:seconds"; |
| 85 | 85 | |
| 86 | 86 | $this->cache() |
| 87 | - ->rememberForever($cacheKey, function () use ($seconds) { |
|
| 87 | + ->rememberForever($cacheKey, function() use ($seconds) { |
|
| 88 | 88 | return $seconds; |
| 89 | 89 | }); |
| 90 | 90 | |
| 91 | 91 | $cacheKey = "{$cachePrefix}:{$modelClassName}-cooldown:invalidated-at"; |
| 92 | 92 | $this->cache() |
| 93 | - ->rememberForever($cacheKey, function () { |
|
| 93 | + ->rememberForever($cacheKey, function() { |
|
| 94 | 94 | return (new Carbon)->now(); |
| 95 | 95 | }); |
| 96 | 96 | |