1 | <?php |
||
15 | class CacheFactory |
||
16 | { |
||
17 | /** |
||
18 | * @return ArrayCache |
||
19 | */ |
||
20 | public static function arrayCache() |
||
24 | |||
25 | /** |
||
26 | * @param $host |
||
27 | * @param $port |
||
28 | * @param int $db |
||
29 | * @param float $timeOut |
||
30 | * |
||
31 | * @return RedisCache |
||
32 | */ |
||
33 | public static function redisFromParams($host, $port = 6379, $db = 0, $timeOut = 0.0) |
||
34 | { |
||
35 | $redis = new Redis(); |
||
36 | $redis->pconnect($host, $port, $timeOut); |
||
37 | $redis->select($db); |
||
38 | |||
39 | return self::redisCache($redis); |
||
40 | } |
||
41 | |||
42 | /** |
||
43 | * @param Redis $redis |
||
44 | * |
||
45 | * @return RedisCache |
||
46 | */ |
||
47 | public static function redisCache(Redis $redis) |
||
48 | { |
||
49 | return new RedisCache($redis); |
||
50 | } |
||
51 | |||
52 | /** |
||
53 | * @param Cache $cache |
||
54 | * |
||
55 | * @return TestCacheDecorator |
||
56 | */ |
||
57 | public static function decorateForTesting(Cache $cache) |
||
61 | } |
||
62 |