@@ -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 | |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | |
| 94 | 94 | public function getModelCacheCooldown(Model $instance) : array |
| 95 | 95 | { |
| 96 | - if (! $instance->cacheCooldownSeconds) { |
|
| 96 | + if (!$instance->cacheCooldownSeconds) { |
|
| 97 | 97 | return [null, null, null]; |
| 98 | 98 | } |
| 99 | 99 | |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | [$cacheCooldown, $invalidatedAt, $savedAt] = $this |
| 103 | 103 | ->getCacheCooldownDetails($instance, $cachePrefix, $modelClassName); |
| 104 | 104 | |
| 105 | - if (! $cacheCooldown || $cacheCooldown === 0) { |
|
| 105 | + if (!$cacheCooldown || $cacheCooldown === 0) { |
|
| 106 | 106 | return [null, null, null]; |
| 107 | 107 | } |
| 108 | 108 | |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | { |
| 132 | 132 | [$cacheCooldown, $invalidatedAt] = $this->getModelCacheCooldown($instance); |
| 133 | 133 | |
| 134 | - if (! $cacheCooldown |
|
| 134 | + if (!$cacheCooldown |
|
| 135 | 135 | || (new Carbon)->now()->diffInSeconds($invalidatedAt) < $cacheCooldown |
| 136 | 136 | ) { |
| 137 | 137 | return; |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | { |
| 157 | 157 | [$cacheCooldown, $invalidatedAt] = $instance->getModelCacheCooldown($instance); |
| 158 | 158 | |
| 159 | - if (! $cacheCooldown) { |
|
| 159 | + if (!$cacheCooldown) { |
|
| 160 | 160 | $instance->flushCache(); |
| 161 | 161 | |
| 162 | 162 | return; |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | public function isCachable() : bool |
| 173 | 173 | { |
| 174 | 174 | return $this->isCachable |
| 175 | - && ! config('laravel-model-caching.disabled'); |
|
| 175 | + && !config('laravel-model-caching.disabled'); |
|
| 176 | 176 | } |
| 177 | 177 | |
| 178 | 178 | protected function setCacheCooldownSavedAtTimestamp(Model $instance) |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | $cacheKey = "{$cachePrefix}:{$modelClassName}-cooldown:saved-at"; |
| 183 | 183 | |
| 184 | 184 | $instance->cache() |
| 185 | - ->rememberForever($cacheKey, function () { |
|
| 185 | + ->rememberForever($cacheKey, function() { |
|
| 186 | 186 | return (new Carbon)->now(); |
| 187 | 187 | }); |
| 188 | 188 | } |
@@ -20,22 +20,22 @@ discard block |
||
| 20 | 20 | $key = $instance->makeCacheKey(); |
| 21 | 21 | |
| 22 | 22 | return $instance->cache($tags) |
| 23 | - ->rememberForever($key, function () use ($columns) { |
|
| 23 | + ->rememberForever($key, function() use ($columns) { |
|
| 24 | 24 | return parent::all($columns); |
| 25 | 25 | }); |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | public static function bootCachable() |
| 29 | 29 | { |
| 30 | - static::created(function ($instance) { |
|
| 30 | + static::created(function($instance) { |
|
| 31 | 31 | $instance->checkCooldownAndFlushAfterPersisting($instance); |
| 32 | 32 | }); |
| 33 | 33 | |
| 34 | - static::deleted(function ($instance) { |
|
| 34 | + static::deleted(function($instance) { |
|
| 35 | 35 | $instance->checkCooldownAndFlushAfterPersisting($instance); |
| 36 | 36 | }); |
| 37 | 37 | |
| 38 | - static::saved(function ($instance) { |
|
| 38 | + static::saved(function($instance) { |
|
| 39 | 39 | $instance->checkCooldownAndFlushAfterPersisting($instance); |
| 40 | 40 | }); |
| 41 | 41 | |
@@ -44,15 +44,15 @@ discard block |
||
| 44 | 44 | // $instance->checkCooldownAndFlushAfterPersisting($instance); |
| 45 | 45 | // }); |
| 46 | 46 | |
| 47 | - static::pivotAttached(function ($instance) { |
|
| 47 | + static::pivotAttached(function($instance) { |
|
| 48 | 48 | $instance->checkCooldownAndFlushAfterPersisting($instance); |
| 49 | 49 | }); |
| 50 | 50 | |
| 51 | - static::pivotDetached(function ($instance) { |
|
| 51 | + static::pivotDetached(function($instance) { |
|
| 52 | 52 | $instance->checkCooldownAndFlushAfterPersisting($instance); |
| 53 | 53 | }); |
| 54 | 54 | |
| 55 | - static::pivotUpdated(function ($instance) { |
|
| 55 | + static::pivotUpdated(function($instance) { |
|
| 56 | 56 | $instance->checkCooldownAndFlushAfterPersisting($instance); |
| 57 | 57 | }); |
| 58 | 58 | } |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | |
| 69 | 69 | public function newEloquentBuilder($query) |
| 70 | 70 | { |
| 71 | - if (! $this->isCachable()) { |
|
| 71 | + if (!$this->isCachable()) { |
|
| 72 | 72 | $this->isCachable = true; |
| 73 | 73 | |
| 74 | 74 | return new EloquentBuilder($query); |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | EloquentBuilder $query, |
| 91 | 91 | int $seconds = null |
| 92 | 92 | ) : EloquentBuilder { |
| 93 | - if (! $seconds) { |
|
| 93 | + if (!$seconds) { |
|
| 94 | 94 | $seconds = $this->cacheCooldownSeconds; |
| 95 | 95 | } |
| 96 | 96 | |
@@ -99,13 +99,13 @@ discard block |
||
| 99 | 99 | $cacheKey = "{$cachePrefix}:{$modelClassName}-cooldown:seconds"; |
| 100 | 100 | |
| 101 | 101 | $this->cache() |
| 102 | - ->rememberForever($cacheKey, function () use ($seconds) { |
|
| 102 | + ->rememberForever($cacheKey, function() use ($seconds) { |
|
| 103 | 103 | return $seconds; |
| 104 | 104 | }); |
| 105 | 105 | |
| 106 | 106 | $cacheKey = "{$cachePrefix}:{$modelClassName}-cooldown:invalidated-at"; |
| 107 | 107 | $this->cache() |
| 108 | - ->rememberForever($cacheKey, function () { |
|
| 108 | + ->rememberForever($cacheKey, function() { |
|
| 109 | 109 | return (new Carbon)->now(); |
| 110 | 110 | }); |
| 111 | 111 | |