Skip to content

Commit 4b53171

Browse files
authored
Merge pull request #6267 from kenjis/fix-docs-caching.rst
docs: improve caching.rst
2 parents 68b43a3 + 6cae580 commit 4b53171

1 file changed

Lines changed: 46 additions & 21 deletions

File tree

user_guide_src/source/libraries/caching.rst

Lines changed: 46 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -23,47 +23,78 @@ You can grab an instance of the cache engine directly through the Services class
2323

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

26-
=====================
2726
Configuring the Cache
2827
=====================
2928

3029
All configuration for the cache engine is done in **app/Config/Cache.php**. In that file,
3130
the following items are available.
3231

33-
**$handler**
32+
$handler
33+
--------
3434

3535
The is the name of the handler that should be used as the primary handler when starting up the engine.
3636
Available names are: dummy, file, memcached, redis, predis, wincache.
3737

38-
**$backupHandler**
38+
$backupHandler
39+
--------------
3940

40-
In the case that the first choice $handler is not available, this is the next cache handler to load.
41-
This is commonly the **file** handler since the file system is always available, but may not fit
41+
In the case that the first choice ``$handler`` is not available, this is the next cache handler to load.
42+
This is commonly the ``File`` handler since the file system is always available, but may not fit
4243
more complex, multi-server setups.
4344

44-
**$prefix**
45+
$prefix
46+
-------
4547

4648
If you have more than one application using the same cache storage, you can add a custom prefix
4749
string here that is prepended to all key names.
4850

49-
**$ttl**
51+
$ttl
52+
----
5053

5154
The default number of seconds to save items when none is specified.
55+
5256
WARNING: This is not used by framework handlers where 60 seconds is hard-coded, but may be useful
5357
to projects and modules. This will replace the hard-coded value in a future release.
5458

55-
**$file**
59+
$file
60+
-----
5661

5762
This is an array of settings specific to the ``File`` handler to determine how it should save the cache files.
5863

59-
**$memcached**
64+
$memcached
65+
----------
6066

6167
This is an array of servers that will be used when using the ``Memcache(d)`` handler.
6268

63-
**$redis**
69+
$redis
70+
------
6471

6572
The settings for the Redis server that you wish to use when using the ``Redis`` and ``Predis`` handler.
6673

74+
******************
75+
Command-Line Tools
76+
******************
77+
78+
CodeIgniter ships with several :doc:`commands </cli/spark_commands>` that are available
79+
from the command line to help you work with Cache.
80+
These tools are not required to use Cache driver but might help you.
81+
82+
cache:clear
83+
===========
84+
85+
Clears the current system caches::
86+
87+
> php spark cache:clear
88+
89+
cache:info
90+
==========
91+
92+
Shows file cache information in the current system::
93+
94+
> php spark cache:info
95+
96+
.. note:: This command only supports the File cache handler.
97+
6798
***************
6899
Class Reference
69100
***************
@@ -113,8 +144,8 @@ Class Reference
113144

114145
.. literalinclude:: caching/004.php
115146

116-
.. note:: The ``$raw`` parameter is only utilized by Memcache,
117-
in order to allow usage of ``increment()`` and ``decrement()``.
147+
.. note:: The ``$raw`` parameter is only utilized by Memcache,
148+
in order to allow usage of ``increment()`` and ``decrement()``.
118149

119150
.. php:method:: delete($key): bool
120151
@@ -197,8 +228,8 @@ Class Reference
197228

198229
.. literalinclude:: caching/010.php
199230

200-
.. note:: The information returned and the structure of the data is dependent
201-
on which adapter is being used.
231+
.. note:: The information returned and the structure of the data is dependent
232+
on which adapter is being used.
202233

203234
.. php:method:: getMetadata(string $key)
204235
@@ -213,7 +244,7 @@ Class Reference
213244

214245
.. literalinclude:: caching/011.php
215246

216-
.. note:: The information returned and the structure of the data is dependent
247+
.. note:: The information returned and the structure of the data is dependent
217248
on which adapter is being used. Some adapters (File, Memcached, Wincache)
218249
still return ``false`` for missing items.
219250

@@ -235,7 +266,6 @@ Class Reference
235266
Drivers
236267
*******
237268

238-
==================
239269
File-based Caching
240270
==================
241271

@@ -245,7 +275,6 @@ make sure to benchmark your application, as a point can come where disk
245275
I/O will negate positive gains by caching. This requires a cache
246276
directory to be really writable by the application.
247277

248-
=================
249278
Memcached Caching
250279
=================
251280

@@ -256,7 +285,6 @@ Memcached servers can be specified in the cache configuration file. Available op
256285
For more information on Memcached, please see
257286
`https://www.php.net/memcached <https://www.php.net/memcached>`_.
258287

259-
================
260288
WinCache Caching
261289
================
262290

@@ -265,7 +293,6 @@ Under Windows, you can also utilize the WinCache driver.
265293
For more information on WinCache, please see
266294
`https://www.php.net/wincache <https://www.php.net/wincache>`_.
267295

268-
=============
269296
Redis Caching
270297
=============
271298

@@ -279,7 +306,6 @@ Config options to connect to redis server stored in the cache configuration file
279306
For more information on Redis, please see
280307
`https://redis.io <https://redis.io>`_.
281308

282-
==============
283309
Predis Caching
284310
==============
285311

@@ -291,7 +317,6 @@ To use it, from the command line inside your project root::
291317
For more information on Redis, please see
292318
`https://github.com/nrk/predis <https://github.com/nrk/predis>`_.
293319

294-
===========
295320
Dummy Cache
296321
===========
297322

0 commit comments

Comments
 (0)