@@ 32-47 (lines=16) @@ | ||
29 | * |
|
30 | * @author Adam Kadlec <[email protected]> |
|
31 | */ |
|
32 | class MemcachedFactory |
|
33 | { |
|
34 | /** |
|
35 | * @param Utils\ArrayHash $parameters |
|
36 | * @param DI\Container $container |
|
37 | * |
|
38 | * @return Cached\Storage\Memcached |
|
39 | */ |
|
40 | public static function create(Utils\ArrayHash $parameters, DI\Container $container) : Cached\Storage\Memcached |
|
41 | { |
|
42 | /** @var \Memcached $client */ |
|
43 | $client = $parameters->client ? $container->getService($parameters->client) : NULL; |
|
44 | ||
45 | return new Cached\Storage\Memcached($client, $parameters->key, $parameters->expires); |
|
46 | } |
|
47 | } |
|
48 |
@@ 34-49 (lines=16) @@ | ||
31 | * |
|
32 | * @author Adam Kadlec <[email protected]> |
|
33 | */ |
|
34 | class PredisFactory |
|
35 | { |
|
36 | /** |
|
37 | * @param Utils\ArrayHash $parameters |
|
38 | * @param DI\Container $container |
|
39 | * |
|
40 | * @return Cached\Storage\Predis |
|
41 | */ |
|
42 | public static function create(Utils\ArrayHash $parameters, DI\Container $container) : Cached\Storage\Predis |
|
43 | { |
|
44 | /** @var Predis\Client $client */ |
|
45 | $client = $parameters->client ? $container->getService($parameters->client) : NULL; |
|
46 | ||
47 | return new Cached\Storage\Predis($client, $parameters->key, $parameters->expires); |
|
48 | } |
|
49 | } |
|
50 |