Skip to content

Commit

Permalink
Merge pull request #517 from FriendsOfSymfony/noop-clear
Browse files Browse the repository at this point in the history
noop can also (not) clear the whole cache
  • Loading branch information
dbu committed Jan 12, 2022
2 parents 6cd6d4e + 32c7d32 commit 843a102
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Expand Up @@ -14,6 +14,10 @@ See also the [GitHub releases page](https://github.com/FriendsOfSymfony/FOSHttpC
If you use the user context, read the updated documentation and call `fos_user_context_hash` in
your `vcl_hash` function.

### Noop Client

* Implemented ClearCapable.

2.11.0
------

Expand Down
4 changes: 2 additions & 2 deletions doc/proxy-clients.rst
Expand Up @@ -26,8 +26,8 @@ Varnish ✓ ✓ ✓ ✓
Fastly ✓ ✓ ✓ ✓
NGINX ✓ ✓
Symfony Cache ✓ ✓ ✓ (1) ✓ (1)
Noop ✓ ✓ ✓ ✓
Multiplexer ✓ ✓ ✓ ✓
Noop ✓ ✓ ✓ ✓
Multiplexer ✓ ✓ ✓ ✓
============= ======= ======= ======= ======= =======

(1): Only when using `Toflar Psr6Store`_.
Expand Down
18 changes: 15 additions & 3 deletions src/ProxyClient/Noop.php
Expand Up @@ -12,17 +12,21 @@
namespace FOS\HttpCache\ProxyClient;

use FOS\HttpCache\ProxyClient\Invalidation\BanCapable;
use FOS\HttpCache\ProxyClient\Invalidation\ClearCapable;
use FOS\HttpCache\ProxyClient\Invalidation\PurgeCapable;
use FOS\HttpCache\ProxyClient\Invalidation\RefreshCapable;
use FOS\HttpCache\ProxyClient\Invalidation\TagCapable;

/**
* This is a no operation client, its only purpose is to provide an implementation for use in an enviroments that
* have no proxy to use.
* This client implements the interfaces but does nothing.
*
* It is useful when testing code that needs a ProxyClient, or to configure in
* environments that have no caching proxy to talk to, like a local development
* setup.
*
* @author Gavin Staniforth <gavin@gsdev.me>
*/
class Noop implements ProxyClient, BanCapable, PurgeCapable, RefreshCapable, TagCapable
class Noop implements ProxyClient, BanCapable, PurgeCapable, RefreshCapable, TagCapable, ClearCapable
{
/**
* {@inheritdoc}
Expand Down Expand Up @@ -71,4 +75,12 @@ public function flush()
{
return 0;
}

/**
* {@inheritdoc}
*/
public function clear()
{
return $this;
}
}

0 comments on commit 843a102

Please sign in to comment.