CacheServiceProvider.php 963B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. namespace Illuminate\Cache;
  3. use Illuminate\Support\ServiceProvider;
  4. class CacheServiceProvider extends ServiceProvider
  5. {
  6. /**
  7. * Indicates if loading of the provider is deferred.
  8. *
  9. * @var bool
  10. */
  11. protected $defer = true;
  12. /**
  13. * Register the service provider.
  14. *
  15. * @return void
  16. */
  17. public function register()
  18. {
  19. $this->app->singleton('cache', function ($app) {
  20. return new CacheManager($app);
  21. });
  22. $this->app->singleton('cache.store', function ($app) {
  23. return $app['cache']->driver();
  24. });
  25. $this->app->singleton('memcached.connector', function () {
  26. return new MemcachedConnector;
  27. });
  28. }
  29. /**
  30. * Get the services provided by the provider.
  31. *
  32. * @return array
  33. */
  34. public function provides()
  35. {
  36. return [
  37. 'cache', 'cache.store', 'memcached.connector',
  38. ];
  39. }
  40. }