1 | <?php |
||
7 | class Memcached extends AbstractSystem |
||
8 | { |
||
9 | /** |
||
10 | * @const ERR_MEMCACHED_NOT_CLASS_DEFINED Exception code if memcache(d) is |
||
11 | * enabled but the class to use is not defined. |
||
12 | */ |
||
13 | const ERR_MEMCACHED_NOT_CLASS_DEFINED = 1507001; |
||
14 | |||
15 | /** |
||
16 | * @const ERR_MEMCACHED_CLASS_NOT_FOUND Exception code if the memcache(d) |
||
17 | * class is not found. |
||
18 | */ |
||
19 | const ERR_MEMCACHED_CLASS_NOT_FOUND = 1507002; |
||
20 | |||
21 | /** |
||
22 | * @const ERR_MEMCACHED_NOT_IMPLEMENT_INTERFACE Exception code the |
||
23 | * memcache(d) class not implement the interface. |
||
24 | */ |
||
25 | const ERR_MEMCACHED_NOT_IMPLEMENT_INTERFACE = 1507003; |
||
26 | |||
27 | /** |
||
28 | * @var \BFW\Memcache\MemcacheInterface|null $memcached The class used |
||
29 | * to connect to memcache(d) server. |
||
30 | * The class name should be declared into config file. |
||
31 | */ |
||
32 | protected $memcached; |
||
33 | |||
34 | /** |
||
35 | * {@inheritdoc} |
||
36 | */ |
||
37 | public function __invoke() |
||
41 | |||
42 | /** |
||
43 | * Getter accessor to property memcached |
||
44 | * |
||
45 | * @return \BFW\Memcache\MemcacheInterface|null |
||
46 | */ |
||
47 | public function getMemcached() |
||
51 | |||
52 | /** |
||
53 | * {@inheritdoc} |
||
54 | * Load and initialize le memcached object |
||
55 | */ |
||
56 | public function init() |
||
61 | |||
62 | /** |
||
63 | * Connect to memcache(d) server with the class declared in config file |
||
64 | * |
||
65 | * @return Object |
||
66 | * |
||
67 | * @throws Exception If memcached is enabled but no class is define. Or if |
||
68 | * The class declared into the config is not found. |
||
69 | */ |
||
70 | protected function loadMemcached() |
||
93 | |||
94 | /** |
||
95 | * Obtain the memcache class name to use |
||
96 | * |
||
97 | * @param array $memcachedConfig |
||
98 | * |
||
99 | * @return string |
||
100 | * |
||
101 | * @throws Exception If there are some problem with the config declared |
||
102 | */ |
||
103 | protected function obtainMemcachedClassName($memcachedConfig) |
||
123 | } |
||
124 |
If you implement
__call
and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.This is often the case, when
__call
is implemented by a parent class and only the child class knows which methods exist: