Total Complexity | 6 |
Total Lines | 66 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
7 | class Memcached extends AbstractSystem |
||
8 | { |
||
9 | /** |
||
10 | * @var \BFW\Memcached $memcached The class used to connect to |
||
11 | * memcache(d) server. |
||
12 | * The class name should be declared into config file. |
||
13 | */ |
||
14 | protected $memcached; |
||
15 | |||
16 | /** |
||
17 | * Load and initialize le memcached object |
||
18 | */ |
||
19 | public function __construct() |
||
20 | { |
||
21 | $this->loadMemcached(); |
||
22 | } |
||
23 | |||
24 | /** |
||
25 | * {@inheritdoc} |
||
26 | * |
||
27 | * @return \BFW\Memcached |
||
28 | */ |
||
29 | public function __invoke() |
||
30 | { |
||
31 | return $this->memcached; |
||
32 | } |
||
33 | |||
34 | /** |
||
35 | * Getter accessor to property memcached |
||
36 | * |
||
37 | * @return \BFW\Memcached |
||
38 | */ |
||
39 | public function getMemcached() |
||
40 | { |
||
41 | return $this->memcached; |
||
42 | } |
||
43 | |||
44 | /** |
||
45 | * Connect to memcache(d) server with the class declared in config file |
||
46 | * |
||
47 | * @return void |
||
48 | * |
||
49 | * @throws \Exception If memcached is enabled but no class is define. Or if |
||
50 | * The class declared into the config is not found. |
||
51 | */ |
||
52 | protected function loadMemcached() |
||
73 | ); |
||
74 | } |
||
75 | } |
||
76 | } |
||
77 |