Skip to content

Commit e62b539

Browse files
authored
Merge pull request #7642 from kenjis/docs-caching-cacheQueryString
docs: add missing "Configuring Caching" in Web Page Caching
2 parents da41b55 + 5f5a5be commit e62b539

File tree

3 files changed

+39
-13
lines changed

3 files changed

+39
-13
lines changed

app/Config/Cache.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,12 @@ class Cache extends BaseConfig
5353
* Whether to take the URL query string into consideration when generating
5454
* output cache files. Valid options are:
5555
*
56-
* false = Disabled
57-
* true = Enabled, take all query parameters into account.
58-
* Please be aware that this may result in numerous cache
59-
* files generated for the same page over and over again.
60-
* array('q') = Enabled, but only take into account the specified list
61-
* of query parameters.
56+
* false = Disabled
57+
* true = Enabled, take all query parameters into account.
58+
* Please be aware that this may result in numerous cache
59+
* files generated for the same page over and over again.
60+
* ['q'] = Enabled, but only take into account the specified list
61+
* of query parameters.
6262
*
6363
* @var bool|string[]
6464
*/

user_guide_src/source/general/caching.rst

+31-7
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,42 @@ How Does Caching Work?
2121

2222
Caching can be enabled on a per-page basis, and you can set the length
2323
of time that a page should remain cached before being refreshed. When a
24-
page is loaded for the first time, the file will be cached using the
25-
currently configured cache engine. On subsequent page loads, the cache file
24+
page is loaded for the first time, the page will be cached using the
25+
currently configured cache engine. On subsequent page loads, the cache
2626
will be retrieved and sent to the requesting user's browser. If it has
2727
expired, it will be deleted and refreshed before being sent to the
2828
browser.
2929

3030
.. note:: The Benchmark tag is not cached so you can still view your page
3131
load speed when caching is enabled.
3232

33+
Configuring Caching
34+
===================
35+
36+
Setting Cache Engine
37+
--------------------
38+
39+
Before using Web Page Caching, you must set the cache engine up by editing
40+
**app/Config/Cache.php**. See :ref:`libraries-caching-configuring-the-cache`
41+
for details.
42+
43+
Setting $cacheQueryString
44+
-------------------------
45+
46+
You can set whether or not to include the query string when generating the cache
47+
with ``Config\Cache::$cacheQueryString``.
48+
49+
Valid options are:
50+
51+
- ``false``: (default) Disabled. The query string is not taken into account; the
52+
same cache is returned for requests with the same URI path but different query
53+
strings.
54+
- ``true``: Enabled, take all query parameters into account. Be aware that this
55+
may result in numerous cache generated for the same page over and over
56+
again.
57+
- **array**: Enabled, but only take into account the specified list of query
58+
parameters. E.g., ``['q', 'page']``.
59+
3360
Enabling Caching
3461
================
3562

@@ -46,15 +73,12 @@ the order that it appears, so place it wherever it seems most logical to
4673
you. Once the tag is in place, your pages will begin being cached.
4774

4875
.. important:: If you change configuration options that might affect
49-
your output, you have to manually delete your cache files.
50-
51-
.. note:: Before the cache files can be written you must set the cache
52-
engine up by editing **app/Config/Cache.php**.
76+
your output, you have to manually delete your cache.
5377

5478
Deleting Caches
5579
===============
5680

57-
If you no longer wish to cache a file you can remove the caching tag and
81+
If you no longer wish to cache a page you can remove the caching tag and
5882
it will no longer be refreshed when it expires.
5983

6084
.. note:: Removing the tag will not delete the cache immediately. It will

user_guide_src/source/libraries/caching.rst

+2
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ You can grab an instance of the cache engine directly through the Services class
2323

2424
.. literalinclude:: caching/002.php
2525

26+
.. _libraries-caching-configuring-the-cache:
27+
2628
*********************
2729
Configuring the Cache
2830
*********************

0 commit comments

Comments
 (0)