Skip to content

Commit 46045bc

Browse files
Nyholmjaviereguiluz
authored andcommitted
fixes
1 parent f59c055 commit 46045bc

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

components/cache.rst

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ Installation
2424
2525
.. include:: /components/require_autoload.rst.inc
2626

27+
.. _cache-psr-6-versus-simple-cache-psr-16:
28+
2729
Cache Contracts versus PSR-6
2830
----------------------------
2931

@@ -51,7 +53,7 @@ This component includes *two* different approaches to caching:
5153
Cache Contracts
5254
---------------
5355

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
5557
``delete``. The first thing you need is to instantiate a cache adapter. The
5658
:class:`Symfony\\Component\\Cache\\Simple\\FilesystemCache` is used in this example::
5759

@@ -87,10 +89,10 @@ The Cache Contracts also comes with built in `Stampede prevention`_. This will
8789
remove CPU spikes at the moments when the cache is cold. If an example application
8890
spends 5 seconds to compute data that is cached for 1 hour. This data is accessed
8991
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
9496

9597
The solution is to recompute the value before the cache expires. The algorithm
9698
randomly fakes a cache miss for one user while others still is served the cached

0 commit comments

Comments
 (0)