|
@@ -24,11 +24,11 @@ discard block |
|
|
block discarded – undo |
|
24
|
24
|
__DIR__.'/../config/laravel-cache.php' => config_path('laravel-cache.php'), |
|
25
|
25
|
], 'config'); |
|
26
|
26
|
|
|
27
|
|
- $this->app->bind(AlternativeCacheStore::class, function () { |
|
|
27
|
+ $this->app->bind(AlternativeCacheStore::class, function() { |
|
28
|
28
|
return $this->app->make(CacheManager::class)->store()->getStore(); |
|
29
|
29
|
}); |
|
30
|
30
|
|
|
31
|
|
- Event::listen(['eloquent.created: *', 'eloquent.updated: *', 'eloquent.deleted: *', 'eloquent.restored: *'], function (Model $model) { |
|
|
31
|
+ Event::listen(['eloquent.created: *', 'eloquent.updated: *', 'eloquent.deleted: *', 'eloquent.restored: *'], function(Model $model) { |
|
32
|
32
|
/** @var CacheInvalidator $cacheInvalidator */ |
|
33
|
33
|
$cacheInvalidator = $this->app->make(CacheInvalidator::class); |
|
34
|
34
|
$cacheInvalidator->invalidateByModel($model); |
|
@@ -43,9 +43,9 @@ discard block |
|
|
block discarded – undo |
|
43
|
43
|
public function register() |
|
44
|
44
|
{ |
|
45
|
45
|
$this->app->register(AlternativeCacheStoresServiceProvider::class); |
|
46
|
|
- $this->app->afterResolving('cache', function () { |
|
|
46
|
+ $this->app->afterResolving('cache', function() { |
|
47
|
47
|
$cacheManager = $this->app->make('cache'); |
|
48
|
|
- $cacheManager->extend('redis', function ($app, array $cacheConfig) use ($cacheManager) { |
|
|
48
|
+ $cacheManager->extend('redis', function($app, array $cacheConfig) use ($cacheManager) { |
|
49
|
49
|
$store = new AlternativeRedisCacheStore( |
|
50
|
50
|
$app['redis'], |
|
51
|
51
|
array_get($cacheConfig, 'prefix') ?: config('cache.prefix'), |