You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/migration/wsc61/caching.md
+13-5Lines changed: 13 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,7 +12,7 @@ The new caching systems solves this moving the any request for a cache rebuild i
12
12
13
13
This will add the burden to rebuild these caches onto the current request which is usually an (in comparison) expensive request anyway.
14
14
The idea behind this is that adding a few miliseconds to a request that already takes half a second makes no difference to the user.
15
-
On the other hand, accessing a thread and suddenly have a significantly longer loading time is unexpected to the visitor.
15
+
On the other hand, accessing a page and suddenly have a significantly longer loading time is unexpected to the visitor.
16
16
17
17
Performing a full cache reset will still have the same latency impact as before.
18
18
@@ -23,6 +23,8 @@ Performing a full cache reset will still have the same latency impact as before.
23
23
- (Optional) For parameterized caches with state:
24
24
- Use `readonly` properties in the constructor.
25
25
```php
26
+
namespace wcf\system\cache\tolerant;
27
+
26
28
final class FooCache extends AbstractTolerantCache {
27
29
public function __construct(
28
30
public readonly int $categoryID
@@ -43,6 +45,10 @@ An eager cache is guaranteed to be always present, either by fetching the cached
43
45
#### Example
44
46
45
47
```php
48
+
namespace wcf\system\cache\eager;
49
+
50
+
use wcf\system\cache\eager\data\FooCacheData;
51
+
46
52
/**
47
53
* @extends AbstractEagerCache<FooCacheData>
48
54
*/
@@ -76,11 +82,15 @@ The cache content will be refreshed eventually, but callees must not expect the
76
82
77
83
The cache is updated by a background job when the lifetime expires or by a [probabilistic early expiration](https://en.wikipedia.org/wiki/Cache_stampede#Probabilistic_early_expiration).
78
84
The early expiration will randomly queue a tolerant cache for a rebuild before it exceeds its maximum lifetime.
79
-
The odds of an early rebuild increase significantly the less time is remaining, making it very likely that a tolerant does not become stale.
85
+
The odds of an early rebuild increases significantly the less time is remaining, making it very likely that a tolerant does not become stale.
80
86
81
87
#### Example
82
88
83
89
```php
90
+
namespace wcf\system\cache\tolerant;
91
+
92
+
use wcf\system\cache\tolerant\data\BarCacheData;
93
+
84
94
/**
85
95
* @extends AbstractTolerantCache<BarCacheData>
86
96
*/
@@ -101,10 +111,8 @@ final class BarCache extends AbstractTolerantCache
101
111
}
102
112
```
103
113
104
-
This cache can be used as follows
114
+
This cache can be used as follows:
105
115
106
116
```php
107
117
$cache = (new BarCache())->getCache();
108
-
// with a state
109
-
$cache = (new BarCache($parameterOne, $parameterTwo, …))->getCache();
0 commit comments