File tree Expand file tree Collapse file tree 1 file changed +8
-9
lines changed Expand file tree Collapse file tree 1 file changed +8
-9
lines changed Original file line number Diff line number Diff line change @@ -99,15 +99,14 @@ is computed again. The next second the same thing happens. So the data is comput
99
99
about 50 times before the cache is warm again. This is where you need stampede
100
100
prevention
101
101
102
- The first solution is locking: on a per-host basis, only one PHP process is
103
- allowed to compute a specific key at a time. Locking is built in by default so
104
- that you don't have anything specific to do other than leveraging the Cache
105
- Contracts.
106
-
107
- The second solution is also built in when using the Cache Contracts: instead of
108
- waiting for the full delay before expiring a value, it is recomputed ahead of its
109
- expiration date: the `Probabilistic early expiration `_ algorithm randomly fakes a
110
- cache miss for one user while others still are served the cached value. You can
102
+ The first solution is to use locking: only allow one PHP process (on a per-host basis)
103
+ to compute a specific key at a time. Locking is built-in by default, so
104
+ you don't need to do anything beyond leveraging the Cache Contracts.
105
+
106
+ The second solution is also built-in when using the Cache Contracts: instead of
107
+ waiting for the full delay before expiring a value, recompute it ahead of its
108
+ expiration date. The `Probabilistic early expiration `_ algorithm randomly fakes a
109
+ cache miss for one user while others are still served the cached value. You can
111
110
control its behavior with the third optional parameter of
112
111
:method: `Symfony\\ Contracts\\ Cache\\ CacheInterface::get `,
113
112
which is a float value called "beta".
You can’t perform that action at this time.
0 commit comments