-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSuperCacheServiceProvider.php
44 lines (39 loc) · 1.3 KB
/
SuperCacheServiceProvider.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
namespace Padosoft\SuperCache;
use Illuminate\Support\ServiceProvider;
use Padosoft\SuperCache\Console\GetAllTagsOfKeyCommand;
use Padosoft\SuperCache\Console\GetClusterNodesCommand;
use Padosoft\SuperCache\Console\ListenerCommand;
use Padosoft\SuperCache\Console\CleanOrphanedKeysCommand;
class SuperCacheServiceProvider extends ServiceProvider
{
public function register()
{
$this->mergeConfigFrom(
__DIR__ . '/../config/supercache.php',
'supercache'
);
$this->app->singleton(SuperCacheManager::class, function ($app) {
return new SuperCacheManager(new RedisConnector());
});
$this->app->singleton('supercache', function ($app) {
return new SuperCacheManager(new RedisConnector());
});
}
public function boot()
{
// Carica configurazione
$this->publishes([
__DIR__ . '/../config/supercache.php' => config_path('supercache.php'),
], 'config');
// Registra i comandi
if ($this->app->runningInConsole()) {
$this->commands([
GetAllTagsOfKeyCommand::class,
ListenerCommand::class,
CleanOrphanedKeysCommand::class,
GetClusterNodesCommand::class,
]);
}
}
}