Skip to content

Commit 3a83898

Browse files
committed
Add namespace and use to hint at the intended structure
1 parent 6a32a9e commit 3a83898

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

docs/migration/wsc61/caching.md

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ The new caching systems solves this moving the any request for a cache rebuild i
1212

1313
This will add the burden to rebuild these caches onto the current request which is usually an (in comparison) expensive request anyway.
1414
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.
1616

1717
Performing a full cache reset will still have the same latency impact as before.
1818

@@ -23,6 +23,8 @@ Performing a full cache reset will still have the same latency impact as before.
2323
- (Optional) For parameterized caches with state:
2424
- Use `readonly` properties in the constructor.
2525
```php
26+
namespace wcf\system\cache\tolerant;
27+
2628
final class FooCache extends AbstractTolerantCache {
2729
public function __construct(
2830
public readonly int $categoryID
@@ -43,6 +45,10 @@ An eager cache is guaranteed to be always present, either by fetching the cached
4345
#### Example
4446

4547
```php
48+
namespace wcf\system\cache\eager;
49+
50+
use wcf\system\cache\eager\data\FooCacheData;
51+
4652
/**
4753
* @extends AbstractEagerCache<FooCacheData>
4854
*/
@@ -76,11 +82,15 @@ The cache content will be refreshed eventually, but callees must not expect the
7682

7783
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).
7884
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.
8086

8187
#### Example
8288

8389
```php
90+
namespace wcf\system\cache\tolerant;
91+
92+
use wcf\system\cache\tolerant\data\BarCacheData;
93+
8494
/**
8595
* @extends AbstractTolerantCache<BarCacheData>
8696
*/
@@ -101,10 +111,8 @@ final class BarCache extends AbstractTolerantCache
101111
}
102112
```
103113

104-
This cache can be used as follows
114+
This cache can be used as follows:
105115

106116
```php
107117
$cache = (new BarCache())->getCache();
108-
// with a state
109-
$cache = (new BarCache($parameterOne, $parameterTwo, …))->getCache();
110118
```

0 commit comments

Comments
 (0)