码迷,mamicode.com
首页 > Web开发 > 详细

[李景山php]每天laravel-20160922|RedisServicProvider.php

时间:2016-07-23 21:35:23      阅读:179      评论:0      收藏:0      [点我收藏+]

标签:redis

<?php

namespace Illuminate\Redis;

use Illuminate\Support\ServiceProvider;
// this namespace
class RedisServiceProvider extends ServiceProvider
{
    /**
     * Indicates if loading of the provider is deferred.
     *
     * @var bool
     */
    protected $defer = true;// a instance of Service Provider
   // a Redis Service Provider
   // Indicates if loading of the provider is deferred.

    /**
     * Register the service provider.
     *
     * @return void
     */
    public function register()
    {
       $this->app->singleton(‘redis‘, function ($app) {
          return new Database($app[‘config‘][‘database.redis‘]);
       });
    }//Register the service provider
   // a good redis register
   // one parameter is redis
   // other is a Database class

    /**
     * Get the services provided by the provider.
     *
     * @return array
     */
    public function provides()
    {
        return [‘redis‘];
    }// a big redis
   //Get the services provided by the provider
}


本文出自 “专注php” 博客,请务必保留此出处http://jingshanls.blog.51cto.com/3357095/1829002

[李景山php]每天laravel-20160922|RedisServicProvider.php

标签:redis

原文地址:http://jingshanls.blog.51cto.com/3357095/1829002

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!