@@ -24,6 +24,8 @@ Installation
24
24
25
25
.. include :: /components/require_autoload.rst.inc
26
26
27
+ .. _cache-psr-6-versus-simple-cache-psr-16 :
28
+
27
29
Cache Contracts versus PSR-6
28
30
----------------------------
29
31
@@ -51,7 +53,7 @@ This component includes *two* different approaches to caching:
51
53
Cache Contracts
52
54
---------------
53
55
54
- All adapters supports the Cache Contract. It contains only two methods; ``get `` and
56
+ All adapters supports the Cache Contract. It contains only two methods; ``get `` and
55
57
``delete ``. The first thing you need is to instantiate a cache adapter. The
56
58
:class: `Symfony\\ Component\\ Cache\\ Simple\\ FilesystemCache ` is used in this example::
57
59
@@ -87,10 +89,10 @@ The Cache Contracts also comes with built in `Stampede prevention`_. This will
87
89
remove CPU spikes at the moments when the cache is cold. If an example application
88
90
spends 5 seconds to compute data that is cached for 1 hour. This data is accessed
89
91
10 times every second. This means that you mostly have cache hits and everything
90
- is fine. But after one hour, we get 10 new requests to a cold cache. So we start
91
- to compute that data again. The next second the same thing happens. So we start
92
- to compute that data about 50 times before the cache is warm again. This is where
93
- you need stampede prevention.
92
+ is fine. But after one hour, we get 10 new requests to a cold cache. So the data
93
+ is computed again. The next second the same thing happens. So the data is computed
94
+ about 50 times before the cache is warm again. This is where you need stampede
95
+ prevention
94
96
95
97
The solution is to recompute the value before the cache expires. The algorithm
96
98
randomly fakes a cache miss for one user while others still is served the cached
0 commit comments