Skip to content

Commit 42b4872

Browse files
Removing uses of we from HTTP caching book page
1 parent 18687b9 commit 42b4872

File tree

1 file changed

+30
-31
lines changed

1 file changed

+30
-31
lines changed

book/http_cache.rst

Lines changed: 30 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ Caching on the Shoulders of Giants
2222
The most effective way to improve performance of an application is to cache
2323
the full output of a page and then bypass the application entirely on each
2424
subsequent request. Of course, this isn't always possible for highly dynamic
25-
websites, or is it? In this chapter, we'll show you how the Symfony2 cache
26-
system works and why we think this is the best possible approach.
25+
websites, or is it? In this chapter, you'll see how the Symfony2 cache
26+
system works and why this is the best possible approach.
2727

2828
The Symfony2 cache system is different because it relies on the simplicity
2929
and power of the HTTP cache as defined in the :term:`HTTP specification`.
@@ -32,8 +32,8 @@ that defines basic communication on the Web. Once you understand the fundamental
3232
HTTP validation and expiration caching models, you'll be ready to master
3333
the Symfony2 cache system.
3434

35-
For the purposes of learning how to cache with Symfony2, we'll cover the
36-
subject in four steps:
35+
For the purposes of learning how to cache with Symfony2, the
36+
subject is covered in four steps:
3737

3838
#. A :ref:`gateway cache <gateway-caches>`, or reverse proxy, is
3939
an independent layer that sits in front of your application. The reverse
@@ -57,8 +57,8 @@ subject in four steps:
5757
sidebar for only 5 minutes.
5858

5959
Since caching with HTTP isn't unique to Symfony, many articles already exist
60-
on the topic. If you're new to HTTP caching, we *highly* recommend Ryan
61-
Tomayko's article `Things Caches Do`_. Another in-depth resource is Mark
60+
on the topic. If you're new to HTTP caching, Ryan
61+
Tomayko's article `Things Caches Do`_ is *highly* recommended . Another in-depth resource is Mark
6262
Nottingham's `Cache Tutorial`_.
6363

6464
.. index::
@@ -118,8 +118,8 @@ different types of caches:
118118
.. note::
119119

120120
The significance of *private* versus *shared* caches will become more
121-
obvious as we talk about caching responses containing content that is
122-
specific to exactly one user (e.g. account information).
121+
obvious when caching responses containing content that is
122+
specific to exactly one user (e.g. account information) is discussed.
123123

124124
Each response from your application will likely go through one or both of
125125
the first two cache types. These caches are outside of your control but follow
@@ -168,7 +168,7 @@ from your application and returning them to the client.
168168
error_log($kernel->getLog());
169169

170170
The ``AppCache`` object has a sensible default configuration, but it can be
171-
finely tuned via a set of options you can set by overriding the
171+
finely tuned via a set of options you can set by overriding the
172172
:method:`Symfony\\Bundle\\FrameworkBundle\\HttpCache\\HttpCache:getOptions`
173173
method::
174174

@@ -236,8 +236,8 @@ misses.
236236
The Symfony2 reverse proxy is a great tool to use when developing your
237237
website or when you deploy your website to a shared host where you cannot
238238
install anything beyond PHP code. But being written in PHP, it cannot
239-
be as fast as a proxy written in C. That's why we highly recommend you
240-
to use Varnish or Squid on your production servers if possible. The good
239+
be as fast as a proxy written in C. That's why it is highly recommended you
240+
use Varnish or Squid on your production servers if possible. The good
241241
news is that the switch from one proxy server to another is easy and
242242
transparent as no code modification is needed in your application. Start
243243
easy with the Symfony2 reverse proxy and upgrade later to Varnish when
@@ -269,11 +269,10 @@ headers on the response.
269269

270270
Keep in mind that "HTTP" is nothing more than the language (a simple text
271271
language) that web clients (e.g. browsers) and web servers use to communicate
272-
with each other. When we talk about HTTP caching, we're talking about the
273-
part of that language that allows clients and servers to exchange information
274-
related to caching.
272+
with each other. HTTP caching is the part of that language that allows clients
273+
and servers to exchange information related to caching.
275274

276-
HTTP specifies four response cache headers that we're concerned with:
275+
HTTP specifies four response cache headers that are looked at here:
277276

278277
* ``Cache-Control``
279278
* ``Expires``
@@ -421,7 +420,7 @@ on a cache to store and return "fresh" responses.
421420
found in two dedicated parts (`P4 - Conditional Requests`_ and `P6 -
422421
Caching: Browser and intermediary caches`_).
423422

424-
As a web developer, we strongly urge you to read the specification. Its
423+
As a web developer, you are strongly urged to read the specification. Its
425424
clarity and power - even more than ten years after its creation - is
426425
invaluable. Don't be put-off by the appearance of the spec - its contents
427426
are much more beautiful than its cover.
@@ -564,16 +563,16 @@ md5 of the content::
564563
return $response;
565564
}
566565

567-
The :method:`Symfony\\Component\\HttpFoundation\\Response::isNotModified`
568-
method compares the ``ETag`` sent with the ``Request`` with the one set
569-
on the ``Response``. If the two match, the method automatically sets the
566+
The :method:`Symfony\\Component\\HttpFoundation\\Response::isNotModified`
567+
method compares the ``ETag`` sent with the ``Request`` with the one set
568+
on the ``Response``. If the two match, the method automatically sets the
570569
``Response`` status code to 304.
571570

572571
This algorithm is simple enough and very generic, but you need to create the
573572
whole ``Response`` before being able to compute the ETag, which is sub-optimal.
574573
In other words, it saves on bandwidth, but not CPU cycles.
575574

576-
In the :ref:`optimizing-cache-validation` section, we'll show how validation
575+
In the :ref:`optimizing-cache-validation` section, you'll see how validation
577576
can be used more intelligently to determine the validity of a cache without
578577
doing so much work.
579578

@@ -623,9 +622,9 @@ header value::
623622
return $response;
624623
}
625624

626-
The :method:`Symfony\\Component\\HttpFoundation\\Response::isNotModified`
627-
method compares the ``If-Modified-Since`` header sent by the request with
628-
the ``Last-Modified`` header set on the response. If they are equivalent,
625+
The :method:`Symfony\\Component\\HttpFoundation\\Response::isNotModified`
626+
method compares the ``If-Modified-Since`` header sent by the request with
627+
the ``Last-Modified`` header set on the response. If they are equivalent,
629628
the ``Response`` will be set to a 304 status code.
630629

631630
.. note::
@@ -661,7 +660,7 @@ exposing a simple and efficient pattern::
661660
$response = new Response();
662661
$response->setETag($article->computeETag());
663662
$response->setLastModified($article->getPublishedAt());
664-
663+
665664
// Set response as public. Otherwise it will be private by default.
666665
$response->setPublic();
667666

@@ -694,7 +693,7 @@ headers that must not be present for ``304`` responses (see
694693
Varying the Response
695694
~~~~~~~~~~~~~~~~~~~~
696695

697-
So far, we've assumed that each URI has exactly one representation of the
696+
So far, it's been assumed that each URI has exactly one representation of the
698697
target resource. By default, HTTP caching is done by using the URI of the
699698
resource as the cache key. If two people request the same URI of a cacheable
700699
resource, the second person will receive the cached version.
@@ -705,7 +704,7 @@ compress pages when the client supports it, any given URI has two representation
705704
one when the client supports compression, and one when it does not. This
706705
determination is done by the value of the ``Accept-Encoding`` request header.
707706

708-
In this case, we need the cache to store both a compressed and uncompressed
707+
In this case, you need the cache to store both a compressed and uncompressed
709708
version of the response for the particular URI and return them based on the
710709
request's ``Accept-Encoding`` value. This is done by using the ``Vary`` response
711710
header, which is a comma-separated list of different headers whose values
@@ -853,8 +852,8 @@ First, to use ESI, be sure to enable it in your application configuration:
853852
'esi' => array('enabled' => true),
854853
));
855854
856-
Now, suppose we have a page that is relatively static, except for a news
857-
ticker at the bottom of the content. With ESI, we can cache the news ticker
855+
Now, suppose you have a page that is relatively static, except for a news
856+
ticker at the bottom of the content. With ESI, you can cache the news ticker
858857
independent of the rest of the page.
859858

860859
.. code-block:: php
@@ -868,7 +867,7 @@ independent of the rest of the page.
868867
return $response;
869868
}
870869
871-
In this example, we've given the full-page cache a lifetime of ten minutes.
870+
In this example, the full-page cache has a lifetime of ten minutes.
872871
Next, let's include the news ticker in the template by embedding an action.
873872
This is done via the ``render`` helper (See :ref:`templating-embedding-controller`
874873
for more details).
@@ -963,8 +962,8 @@ the ``_internal`` route:
963962

964963
Since this route allows all actions to be accessed via a URL, you might
965964
want to protect it by using the Symfony2 firewall feature (by allowing
966-
access to your reverse proxy's IP range). See the :ref:`Securing by IP<book-security-securing-ip>`
967-
section of the :doc:`Security Chapter </book/security>` for more information
965+
access to your reverse proxy's IP range). See the :ref:`Securing by IP<book-security-securing-ip>`
966+
section of the :doc:`Security Chapter </book/security>` for more information
968967
on how to do this.
969968

970969
One great advantage of this caching strategy is that you can make your

0 commit comments

Comments
 (0)