4
4
Cache
5
5
=====
6
6
7
- Using cache is a great way of making your application run quicker. The Symfony cache
8
- component is shipped with many adapters to different storages. Every adapter is
7
+ Using a cache is a great way of making your application run quicker. The Symfony cache
8
+ component ships with many adapters to different storages. Every adapter is
9
9
developed for high performance.
10
10
11
11
The following example shows a typical usage of the cache::
@@ -27,7 +27,7 @@ The following example shows a typical usage of the cache::
27
27
// ... and to remove the cache key
28
28
$pool->delete('my_cache_key');
29
29
30
- Symfony supports the Cache Contracts, PSR-6/16 and Doctrine Cache interfaces.
30
+ Symfony supports Cache Contracts, PSR-6/16 and Doctrine Cache interfaces.
31
31
You can read more about these at the :doc: `component documentation </components/cache >`.
32
32
33
33
.. _cache-configuration-with-frameworkbundle :
42
42
This is a service that you will interact with. Each pool will always have
43
43
its own namespace and cache items. There is never a conflict between pools.
44
44
**Adapter **
45
- An adapter is a *template * that you use to create Pools .
45
+ An adapter is a *template * that you use to create pools .
46
46
**Provider **
47
- A provider is a service that some adapters are using to connect to the storage.
47
+ A provider is a service that some adapters use to connect to the storage.
48
48
Redis and Memcached are example of such adapters. If a DSN is used as the
49
49
provider then a service is automatically created.
50
50
@@ -102,7 +102,7 @@ The Cache component comes with a series of adapters pre-configured:
102
102
* :doc: `cache.adapter.redis </components/cache/adapters/redis_adapter >`
103
103
104
104
Some of these adapters could be configured via shortcuts. Using these shortcuts
105
- will create pool with service id of ``cache.[type] ``
105
+ will create pools with service IDs that follow the pattern ``cache.[type] ``.
106
106
107
107
.. configuration-block ::
108
108
@@ -263,13 +263,13 @@ You can also create more customized pools:
263
263
],
264
264
]);
265
265
266
- Each pool manages a set of independent cache keys: keys of different pools
266
+ Each pool manages a set of independent cache keys: keys from different pools
267
267
*never * collide, even if they share the same backend. This is achieved by prefixing
268
268
keys with a namespace that's generated by hashing the name of the pool, the name
269
269
of the compiled container class and a :ref: `configurable seed<reference-cache-prefix-seed> `
270
270
that defaults to the project directory.
271
271
272
- Each custom pool becomes a service where the service id is the name of the pool
272
+ Each custom pool becomes a service whose service ID is the name of the pool
273
273
(e.g. ``custom_thing.cache ``). An autowiring alias is also created for each pool
274
274
using the camel case version of its name - e.g. ``custom_thing.cache `` can be
275
275
injected automatically by naming the argument ``$customThingCache `` and type-hinting it
@@ -295,7 +295,7 @@ Custom Provider Options
295
295
296
296
Some providers have specific options that can be configured. The
297
297
:doc: `RedisAdapter </components/cache/adapters/redis_adapter >` allows you to
298
- create providers with option ``timeout ``, ``retry_interval ``. etc. To use these
298
+ create providers with the options ``timeout ``, ``retry_interval ``. etc. To use these
299
299
options with non-default values you need to create your own ``\Redis `` provider
300
300
and use that when configuring the pool.
301
301
@@ -380,7 +380,7 @@ item in a cache chain, Symfony stores it in all pools sequentially. When
380
380
retrieving an item, Symfony tries to get it from the first pool. If it's not
381
381
found, it tries the next pools until the item is found or an exception is thrown.
382
382
Because of this behavior, it's recommended to define the adapters in the chain
383
- in order from the fastest to the slowest.
383
+ in order from fastest to slowest.
384
384
385
385
If an error happens when storing an item in a pool, Symfony stores it in the
386
386
other pools and no exception is thrown. Later, when the item is retrieved,
@@ -444,9 +444,9 @@ Using Cache Tags
444
444
----------------
445
445
446
446
In applications with many cache keys it could be useful to organize the data stored
447
- to be able to invalidate the cache more efficient . One way to achieve that is to
447
+ to be able to invalidate the cache more efficiently . One way to achieve that is to
448
448
use cache tags. One or more tags could be added to the cache item. All items with
449
- the same key could be invalidate with one function call::
449
+ the same key could be invalidated with one function call::
450
450
451
451
use Symfony\Contracts\Cache\ItemInterface;
452
452
use Symfony\Contracts\Cache\TagAwareCacheInterface;
@@ -589,14 +589,14 @@ Clearing the Cache
589
589
590
590
To clear the cache you can use the ``bin/console cache:pool:clear [pool] `` command.
591
591
That will remove all the entries from your storage and you will have to recalculate
592
- all values. You can also group your pools into "cache clearers". There are 3 cache
592
+ all the values. You can also group your pools into "cache clearers". There are 3 cache
593
593
clearers by default:
594
594
595
595
* ``cache.global_clearer ``
596
596
* ``cache.system_clearer ``
597
597
* ``cache.app_clearer ``
598
598
599
- The global clearer clears all the cache in every pool. The system cache clearer
599
+ The global clearer clears all the cache items in every pool. The system cache clearer
600
600
is used in the ``bin/console cache:clear `` command. The app clearer is the default
601
601
clearer.
602
602
0 commit comments