Max-‐Age S-‐maxage Public Private No-‐cache No-‐store Must-‐revalidate Proxy-‐revalidate TTL
for
browsers
in
seconds TTL
for
proxies
in
seconds Proxies
&
browsers
can
cache Only
browsers
can
cache Revalidate
before
dropping
from
cache Don’t
cache
at
all Browser
revalidate
before
serving
from
cache
Proxy
revalidate
before
serving
from
cache
ESI
VCL sub
vcl_recv
{
set
req.http.Surrogate-‐Capability="key=ESI/1.0"; } sub
vcl_fetch
{
if(beresp.http.Surrogate-‐Control~"ESI/1.0")
{
unset
beresp.http.Surrogate-‐Control;
set
beresp.do_esi=true;
} }
namespace MyApp; use Ratchet\MessageComponentInterface; use Ratchet\ConnectionInterface; class Chat implements MessageComponentInterface { protected $clients; public function __construct() { $this->clients = new \SplObjectStorage; } public function onOpen(ConnectionInterface $conn) { $this->clients->attach($conn); } public function onMessage(ConnectionInterface $from, $msg) { foreach ($this->clients as $client) { if ($from !== $client) { $client->send('Response: '.$msg); } } } public function onClose(ConnectionInterface $conn) { $this->clients->detach($conn); } public function onError(ConnectionInterface $conn, \Exception $e) { echo "An error has occurred: {$e->getMessage()}\n"; $conn->close(); } }
require __DIR__.'/vendor/autoload.php'; require 'chat.php'; use Ratchet\WebSocket\WsServer; use Ratchet\Server\IoServer; use MyApp\Chat; $ws = new WsServer(new Chat()); $ws->disableVersion(0); $server = IoServer::factory($ws,80,'1.2.3.4'); $server->run();
✓A
URL
idenKfies
a
resource.
✓Resources
have
a
hierarchy,
so
you
know
that
something
with
addiKonal
slashes
is
a
subordinate
resource ✓Verbs
are
used
to
perform
operaKons
on
resources ✓The
operaKon
is
implicit
and
not
part
of
the
URL ✓A
hypermedia
format
is
used
to
represent
the
data ✓Link
relaKons
are
used
to
navigate
a
service Quodng
David
Zülke
@dzuelke