Skip to content

Commit 843a102

Browse files
authored
Merge pull request #517 from FriendsOfSymfony/noop-clear
noop can also (not) clear the whole cache
2 parents 6cd6d4e + 32c7d32 commit 843a102

File tree

3 files changed

+21
-5
lines changed

3 files changed

+21
-5
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ See also the [GitHub releases page](https://github.com/FriendsOfSymfony/FOSHttpC
1414
If you use the user context, read the updated documentation and call `fos_user_context_hash` in
1515
your `vcl_hash` function.
1616

17+
### Noop Client
18+
19+
* Implemented ClearCapable.
20+
1721
2.11.0
1822
------
1923

doc/proxy-clients.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ Varnish ✓ ✓ ✓ ✓
2626
Fastly ✓ ✓ ✓ ✓
2727
NGINX ✓ ✓
2828
Symfony Cache ✓ ✓ ✓ (1) ✓ (1)
29-
Noop ✓ ✓ ✓ ✓
30-
Multiplexer ✓ ✓ ✓ ✓
29+
Noop ✓ ✓ ✓ ✓
30+
Multiplexer ✓ ✓ ✓ ✓
3131
============= ======= ======= ======= ======= =======
3232

3333
(1): Only when using `Toflar Psr6Store`_.

src/ProxyClient/Noop.php

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,21 @@
1212
namespace FOS\HttpCache\ProxyClient;
1313

1414
use FOS\HttpCache\ProxyClient\Invalidation\BanCapable;
15+
use FOS\HttpCache\ProxyClient\Invalidation\ClearCapable;
1516
use FOS\HttpCache\ProxyClient\Invalidation\PurgeCapable;
1617
use FOS\HttpCache\ProxyClient\Invalidation\RefreshCapable;
1718
use FOS\HttpCache\ProxyClient\Invalidation\TagCapable;
1819

1920
/**
20-
* This is a no operation client, its only purpose is to provide an implementation for use in an enviroments that
21-
* have no proxy to use.
21+
* This client implements the interfaces but does nothing.
22+
*
23+
* It is useful when testing code that needs a ProxyClient, or to configure in
24+
* environments that have no caching proxy to talk to, like a local development
25+
* setup.
2226
*
2327
* @author Gavin Staniforth <[email protected]>
2428
*/
25-
class Noop implements ProxyClient, BanCapable, PurgeCapable, RefreshCapable, TagCapable
29+
class Noop implements ProxyClient, BanCapable, PurgeCapable, RefreshCapable, TagCapable, ClearCapable
2630
{
2731
/**
2832
* {@inheritdoc}
@@ -71,4 +75,12 @@ public function flush()
7175
{
7276
return 0;
7377
}
78+
79+
/**
80+
* {@inheritdoc}
81+
*/
82+
public function clear()
83+
{
84+
return $this;
85+
}
7486
}

0 commit comments

Comments
 (0)