@@ -22,22 +22,22 @@ discard block |
||
| 22 | 22 | $key = $instance->makeCacheKey(); |
| 23 | 23 | |
| 24 | 24 | return $instance->cache($tags) |
| 25 | - ->rememberForever($key, function () use ($columns) { |
|
| 25 | + ->rememberForever($key, function() use ($columns) { |
|
| 26 | 26 | return parent::all($columns); |
| 27 | 27 | }); |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | public static function bootCachable() |
| 31 | 31 | { |
| 32 | - static::created(function ($instance) { |
|
| 32 | + static::created(function($instance) { |
|
| 33 | 33 | $instance->checkCooldownAndFlushAfterPersisting($instance); |
| 34 | 34 | }); |
| 35 | 35 | |
| 36 | - static::deleted(function ($instance) { |
|
| 36 | + static::deleted(function($instance) { |
|
| 37 | 37 | $instance->checkCooldownAndFlushAfterPersisting($instance); |
| 38 | 38 | }); |
| 39 | 39 | |
| 40 | - static::saved(function ($instance) { |
|
| 40 | + static::saved(function($instance) { |
|
| 41 | 41 | $instance->checkCooldownAndFlushAfterPersisting($instance); |
| 42 | 42 | }); |
| 43 | 43 | |
@@ -46,15 +46,15 @@ discard block |
||
| 46 | 46 | // $instance->checkCooldownAndFlushAfterPersisting($instance); |
| 47 | 47 | // }); |
| 48 | 48 | |
| 49 | - static::pivotAttached(function ($instance, $secondInstance, $relationship) { |
|
| 49 | + static::pivotAttached(function($instance, $secondInstance, $relationship) { |
|
| 50 | 50 | $instance->checkCooldownAndFlushAfterPersisting($instance, $relationship); |
| 51 | 51 | }); |
| 52 | 52 | |
| 53 | - static::pivotDetached(function ($instance, $secondInstance, $relationship) { |
|
| 53 | + static::pivotDetached(function($instance, $secondInstance, $relationship) { |
|
| 54 | 54 | $instance->checkCooldownAndFlushAfterPersisting($instance, $relationship); |
| 55 | 55 | }); |
| 56 | 56 | |
| 57 | - static::pivotUpdated(function ($instance, $secondInstance, $relationship) { |
|
| 57 | + static::pivotUpdated(function($instance, $secondInstance, $relationship) { |
|
| 58 | 58 | $instance->checkCooldownAndFlushAfterPersisting($instance, $relationship); |
| 59 | 59 | }); |
| 60 | 60 | } |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | |
| 71 | 71 | public function newEloquentBuilder($query) |
| 72 | 72 | { |
| 73 | - if (! $this->isCachable()) { |
|
| 73 | + if (!$this->isCachable()) { |
|
| 74 | 74 | $this->isCachable = false; |
| 75 | 75 | |
| 76 | 76 | return new EloquentBuilder($query); |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | EloquentBuilder $query, |
| 115 | 115 | int $seconds = null |
| 116 | 116 | ) : EloquentBuilder { |
| 117 | - if (! $seconds) { |
|
| 117 | + if (!$seconds) { |
|
| 118 | 118 | $seconds = $this->cacheCooldownSeconds; |
| 119 | 119 | } |
| 120 | 120 | |
@@ -123,13 +123,13 @@ discard block |
||
| 123 | 123 | $cacheKey = "{$cachePrefix}:{$modelClassName}-cooldown:seconds"; |
| 124 | 124 | |
| 125 | 125 | $this->cache() |
| 126 | - ->rememberForever($cacheKey, function () use ($seconds) { |
|
| 126 | + ->rememberForever($cacheKey, function() use ($seconds) { |
|
| 127 | 127 | return $seconds; |
| 128 | 128 | }); |
| 129 | 129 | |
| 130 | 130 | $cacheKey = "{$cachePrefix}:{$modelClassName}-cooldown:invalidated-at"; |
| 131 | 131 | $this->cache() |
| 132 | - ->rememberForever($cacheKey, function () { |
|
| 132 | + ->rememberForever($cacheKey, function() { |
|
| 133 | 133 | return (new Carbon)->now(); |
| 134 | 134 | }); |
| 135 | 135 | |
@@ -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 | |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | |
| 110 | 110 | public function getModelCacheCooldown(Model $instance) : array |
| 111 | 111 | { |
| 112 | - if (! $instance->cacheCooldownSeconds) { |
|
| 112 | + if (!$instance->cacheCooldownSeconds) { |
|
| 113 | 113 | return [null, null, null]; |
| 114 | 114 | } |
| 115 | 115 | |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | [$cacheCooldown, $invalidatedAt, $savedAt] = $this |
| 119 | 119 | ->getCacheCooldownDetails($instance, $cachePrefix, $modelClassName); |
| 120 | 120 | |
| 121 | - if (! $cacheCooldown || $cacheCooldown === 0) { |
|
| 121 | + if (!$cacheCooldown || $cacheCooldown === 0) { |
|
| 122 | 122 | return [null, null, null]; |
| 123 | 123 | } |
| 124 | 124 | |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | { |
| 148 | 148 | [$cacheCooldown, $invalidatedAt] = $this->getModelCacheCooldown($instance); |
| 149 | 149 | |
| 150 | - if (! $cacheCooldown |
|
| 150 | + if (!$cacheCooldown |
|
| 151 | 151 | || (new Carbon)->now()->diffInSeconds($invalidatedAt) < $cacheCooldown |
| 152 | 152 | ) { |
| 153 | 153 | return; |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | { |
| 173 | 173 | [$cacheCooldown, $invalidatedAt] = $instance->getModelCacheCooldown($instance); |
| 174 | 174 | |
| 175 | - if (! $cacheCooldown) { |
|
| 175 | + if (!$cacheCooldown) { |
|
| 176 | 176 | $instance->flushCache(); |
| 177 | 177 | |
| 178 | 178 | if ($relationship) { |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | public function isCachable() : bool |
| 197 | 197 | { |
| 198 | 198 | return $this->isCachable |
| 199 | - && ! config('laravel-model-caching.disabled'); |
|
| 199 | + && !config('laravel-model-caching.disabled'); |
|
| 200 | 200 | } |
| 201 | 201 | |
| 202 | 202 | protected function setCacheCooldownSavedAtTimestamp(Model $instance) |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | $cacheKey = "{$cachePrefix}:{$modelClassName}-cooldown:saved-at"; |
| 207 | 207 | |
| 208 | 208 | $instance->cache() |
| 209 | - ->rememberForever($cacheKey, function () { |
|
| 209 | + ->rememberForever($cacheKey, function() { |
|
| 210 | 210 | return (new Carbon)->now(); |
| 211 | 211 | }); |
| 212 | 212 | } |