mirror of
https://github.com/flarum/framework.git
synced 2025-01-22 12:16:31 +08:00
We don't need to make the cache adapter configurable like this
This commit is contained in:
parent
8e35afe204
commit
ee8f4f04de
|
@ -86,11 +86,12 @@ abstract class AbstractServer
|
|||
|
||||
$this->registerLogger($app);
|
||||
|
||||
$this->registerCache($app);
|
||||
|
||||
$app->register('Flarum\Database\DatabaseServiceProvider');
|
||||
$app->register('Flarum\Settings\SettingsServiceProvider');
|
||||
$app->register('Flarum\Locale\LocaleServiceProvider');
|
||||
$app->register('Illuminate\Bus\BusServiceProvider');
|
||||
$app->register('Illuminate\Cache\CacheServiceProvider');
|
||||
$app->register('Illuminate\Filesystem\FilesystemServiceProvider');
|
||||
$app->register('Illuminate\Hashing\HashServiceProvider');
|
||||
$app->register('Illuminate\Mail\MailServiceProvider');
|
||||
|
@ -135,16 +136,6 @@ abstract class AbstractServer
|
|||
'mail' => [
|
||||
'driver' => 'mail',
|
||||
],
|
||||
'cache' => [
|
||||
'default' => 'file',
|
||||
'stores' => [
|
||||
'file' => [
|
||||
'driver' => 'file',
|
||||
'path' => $app->storagePath().'/cache',
|
||||
],
|
||||
],
|
||||
'prefix' => 'flarum',
|
||||
],
|
||||
'filesystems' => [
|
||||
'default' => 'local',
|
||||
'cloud' => 's3',
|
||||
|
@ -174,4 +165,24 @@ abstract class AbstractServer
|
|||
$app->instance('log', $logger);
|
||||
$app->alias('log', 'Psr\Log\LoggerInterface');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Application $app
|
||||
*/
|
||||
protected function registerCache(Application $app)
|
||||
{
|
||||
$app->singleton('cache.store', function ($app) {
|
||||
return new \Illuminate\Cache\Repository($app->make('cache.filestore'));
|
||||
});
|
||||
|
||||
$app->singleton('cache.filestore', function ($app) {
|
||||
return new \Illuminate\Cache\FileStore(
|
||||
new \Illuminate\Filesystem\Filesystem(),
|
||||
$app->storagePath().'/cache'
|
||||
);
|
||||
});
|
||||
|
||||
$app->alias('cache.filestore', 'Illuminate\Contracts\Cache\Store');
|
||||
$app->alias('cache.store', 'Illuminate\Contracts\Cache\Repository');
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user