|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* Lenevor Framework |
|
5
|
|
|
* |
|
6
|
|
|
* LICENSE |
|
7
|
|
|
* |
|
8
|
|
|
* This source file is subject to the new BSD license that is bundled |
|
9
|
|
|
* with this package in the file license.md. |
|
10
|
|
|
* It is also available through the world-wide-web at this URL: |
|
11
|
|
|
* https://lenevor.com/license |
|
12
|
|
|
* If you did not receive a copy of the license and are unable to |
|
13
|
|
|
* obtain it through the world-wide-web, please send an email |
|
14
|
|
|
* to [email protected] so we can send you a copy immediately. |
|
15
|
|
|
* |
|
16
|
|
|
* @package Lenevor |
|
17
|
|
|
* @subpackage Base |
|
18
|
|
|
* @link https://lenevor.com |
|
19
|
|
|
* @copyright Copyright (c) 2019 - 2021 Alexander Campo <[email protected]> |
|
20
|
|
|
* @license https://opensource.org/licenses/BSD-3-Clause New BSD license or see https://lenevor.com/license or see /license.md |
|
21
|
|
|
*/ |
|
22
|
|
|
|
|
23
|
|
|
namespace Syscodes\Cache; |
|
24
|
|
|
|
|
25
|
|
|
use Syscodes\Support\ServiceProvider; |
|
26
|
|
|
use Syscodes\Contracts\Support\Deferrable; |
|
27
|
|
|
use Syscodes\Cache\Store\MemcachedConnector; |
|
28
|
|
|
|
|
29
|
|
|
/** |
|
30
|
|
|
* For loading the classes from the container of services. |
|
31
|
|
|
* |
|
32
|
|
|
* @author Alexander Campo <[email protected]> |
|
33
|
|
|
*/ |
|
34
|
|
|
class CacheServiceProvider extends ServiceProvider implements Deferrable |
|
35
|
|
|
{ |
|
36
|
|
|
/** |
|
37
|
|
|
* Register the service provider. |
|
38
|
|
|
* |
|
39
|
|
|
* @return void |
|
40
|
|
|
*/ |
|
41
|
|
|
public function register() |
|
42
|
|
|
{ |
|
43
|
|
|
$this->app->singleton('cache', function ($app) { |
|
44
|
|
|
return (new CacheManager($app)); |
|
45
|
|
|
}); |
|
46
|
|
|
|
|
47
|
|
|
$this->app->singleton('cache.store', function ($app) { |
|
48
|
|
|
return $app['cache']->driver(); |
|
49
|
|
|
}); |
|
50
|
|
|
|
|
51
|
|
|
$this->app->singleton('memcached.connector', function () { |
|
52
|
|
|
return new MemcachedConnector; |
|
53
|
|
|
}); |
|
54
|
|
|
} |
|
55
|
|
|
|
|
56
|
|
|
/** |
|
57
|
|
|
* Get the services provided by the provider. |
|
58
|
|
|
* |
|
59
|
|
|
* @return array |
|
60
|
|
|
*/ |
|
61
|
|
|
public function provides() |
|
62
|
|
|
{ |
|
63
|
|
|
return [ |
|
64
|
|
|
'cache', 'cache.store', 'memcached.connector', |
|
65
|
|
|
]; |
|
66
|
|
|
} |
|
67
|
|
|
} |