| @@ 143-161 (lines=19) @@ | ||
| 140 | ||
| 141 | } |
|
| 142 | ||
| 143 | public static function createFromConfiguration(Configuration $configuration, LoggerInterface $logger, $stanza = null) { |
|
| 144 | ||
| 145 | list($enable, $manager_configuration, $providers) = ConfigurationParser::parse($configuration, $logger, $stanza); |
|
| 146 | ||
| 147 | $manager = new Manager(...$manager_configuration); |
|
| 148 | ||
| 149 | if ( $enable ) { |
|
| 150 | foreach ( $providers as $name => $provider ) { |
|
| 151 | $instance = $provider->instance; |
|
| 152 | $weight = $provider->weight; |
|
| 153 | $id = $instance->getId(); |
|
| 154 | $logger->debug("Adding provider $name ($id) to cache manager (w $weight)"); |
|
| 155 | $manager->addProvider($instance, $weight); |
|
| 156 | } |
|
| 157 | } |
|
| 158 | ||
| 159 | return $manager; |
|
| 160 | ||
| 161 | } |
|
| 162 | ||
| 163 | protected function selectFrom($mode, $key) { |
|
| 164 | ||
| @@ 185-203 (lines=19) @@ | ||
| 182 | ||
| 183 | } |
|
| 184 | ||
| 185 | public static function createFromConfiguration(Configuration $configuration, LoggerInterface $logger, $stanza = null) { |
|
| 186 | ||
| 187 | list($enable, $manager_configuration, $providers) = ConfigurationParser::parse($configuration, $logger, $stanza); |
|
| 188 | ||
| 189 | $manager = new Manager(...$manager_configuration); |
|
| 190 | ||
| 191 | if ( $enable ) { |
|
| 192 | foreach ( $providers as $name => $provider ) { |
|
| 193 | $instance = $provider->instance; |
|
| 194 | $weight = $provider->weight; |
|
| 195 | $id = $instance->getId(); |
|
| 196 | $logger->debug("Adding provider $name ($id) to cache manager (w $weight)"); |
|
| 197 | $manager->addProvider($instance, $weight); |
|
| 198 | } |
|
| 199 | } |
|
| 200 | ||
| 201 | return $manager; |
|
| 202 | ||
| 203 | } |
|
| 204 | ||
| 205 | protected function selectFrom($mode, $key, $default = null) { |
|
| 206 | ||