Skip to content

Commit

Permalink
compatibility miss redis extension
Browse files Browse the repository at this point in the history
  • Loading branch information
xujiajun committed Jul 27, 2017
1 parent 9323289 commit 21d7b45
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/Framework/Cache/CacheServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ public function register()

if ($cache == 'redisCache') {
$this->app->singleton($cache, function () {
if (!extension_loaded('redis')) {
return null;
}
return new RedisCacheService($this->app->singleton('redis'));
});
}
Expand Down
6 changes: 5 additions & 1 deletion src/Framework/Cache/RedisServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,13 @@ class RedisServiceProvider extends ServiceProvider
*/
public function register()
{
if (!extension_loaded('redis')) {
return null;
}

$this->app->singleton('redis', function () {

$config = \Config::parse('redis',[
$config = \Config::parse('redis', [
'host' => '127.0.0.1',
'port' => 6379,
'connect' => 'persistence',
Expand Down

0 comments on commit 21d7b45

Please sign in to comment.