Index: trunk/phase3/includes/specials/SpecialCachedPage.php |
— | — | @@ -3,12 +3,13 @@ |
4 | 4 | /** |
5 | 5 | * Abstract special page class with scaffolding for caching the HTML output. |
6 | 6 | * |
7 | | - * To enable the caching functionality, the cacheExpiry field should be set |
8 | | - * before parent::execute is called (and it should be called from execute). |
9 | | - * |
10 | 7 | * To add HTML that should be cached, use addCachedHTML like this: |
11 | | - * $this->addCachedHTML( array( $this, 'displayCachedContent' ) ); |
| 8 | + * $this->addCachedHTML( $callback ); |
12 | 9 | * |
| 10 | + * The callback function is only called when needed, so do all your expensive |
| 11 | + * computations here. This function should returns the HTML to be cached. |
| 12 | + * It should not add anything to the PageOutput object! |
| 13 | + * |
13 | 14 | * Before the first addCachedHTML call, you should call $this->startCache(); |
14 | 15 | * After adding the last HTML that should be cached, call $this->saveCache(); |
15 | 16 | * |
— | — | @@ -144,6 +145,11 @@ |
145 | 146 | } |
146 | 147 | } |
147 | 148 | |
| 149 | + /** |
| 150 | + * Gets called after the cache got initialized. |
| 151 | + * |
| 152 | + * @since 1.20 |
| 153 | + */ |
148 | 154 | protected function onCacheInitialized() { |
149 | 155 | if ( $this->hasCached ) { |
150 | 156 | $this->getOutput()->setSubtitle( $this->getCachedNotice() ); |