1 | <?php |
||
23 | class MultiplexerClient implements BanInterface, PurgeInterface, RefreshInterface |
||
24 | { |
||
25 | /** |
||
26 | * @var ProxyClientInterface[] |
||
27 | */ |
||
28 | private $proxyClients; |
||
29 | |||
30 | /** |
||
31 | * MultiplexerClient constructor. |
||
32 | * |
||
33 | * @param ProxyClientInterface[] $proxyClients The list of Proxy clients |
||
34 | */ |
||
35 | 6 | public function __construct(array $proxyClients) |
|
47 | |||
48 | /** |
||
49 | * Forwards to all clients. |
||
50 | * |
||
51 | * @param array $headers HTTP headers that path must match to be banned |
||
52 | * |
||
53 | * @return $this |
||
54 | */ |
||
55 | 1 | public function ban(array $headers) |
|
61 | |||
62 | /** |
||
63 | * Forwards to all clients. |
||
64 | * |
||
65 | * @param string $path Regular expression pattern for URI to invalidate |
||
66 | * @param string $contentType Regular expression pattern for the content type to limit banning, for instance |
||
67 | * 'text' |
||
68 | * @param array|string $hosts Regular expression of a host name or list of exact host names to limit banning |
||
69 | * |
||
70 | * @return $this |
||
71 | */ |
||
72 | 1 | public function banPath($path, $contentType = null, $hosts = null) |
|
78 | |||
79 | /** |
||
80 | * Forwards to all clients. |
||
81 | * |
||
82 | * @return int The number of cache invalidations performed per caching server |
||
83 | * |
||
84 | * @throws ExceptionCollection If any errors occurred during flush |
||
85 | */ |
||
86 | 1 | public function flush() |
|
95 | |||
96 | /** |
||
97 | * Forwards to all clients. |
||
98 | * |
||
99 | * @param string $url Path or URL to purge |
||
100 | * @param array $headers Extra HTTP headers to send to the caching proxy (optional) |
||
101 | * |
||
102 | * @return $this |
||
103 | */ |
||
104 | public function purge($url, array $headers = array()) |
||
110 | |||
111 | /** |
||
112 | * Forwards to all clients. |
||
113 | * |
||
114 | * @param string $url Path or URL to refresh |
||
115 | * @param array $headers Extra HTTP headers to send to the caching proxy (optional) |
||
116 | * |
||
117 | * @return $this |
||
118 | */ |
||
119 | 1 | public function refresh($url, array $headers = []) |
|
125 | |||
126 | /** |
||
127 | * Helper function to invoke the given $method on all available ProxyClients implementing the given $interface. |
||
128 | * |
||
129 | * @param string $interface The FQN of the interface |
||
130 | * @param string $method The method to invoke |
||
131 | * @param array $arguments The arguments to be passed to the method |
||
132 | */ |
||
133 | 3 | private function invoke($interface, $method, array $arguments) |
|
141 | } |
||
142 |