@@ -104,6 +104,8 @@ trait RenderedPageHtmlDao {
104
104
// don't use the mem cache (which post to use as the root isn't incl in the cache key). [5V7ZTL2]
105
105
useMemCache &= pageRequest.pageRoot.contains(PageParts .BodyNr )
106
106
107
+ // Bypass the cache for benchmarking
108
+ useMemCache = false
107
109
108
110
val renderParams = PageRenderParams (
109
111
widthLayout = if (pageRequest.isMobile) WidthLayout .Tiny else WidthLayout .Medium ,
@@ -173,38 +175,38 @@ trait RenderedPageHtmlDao {
173
175
// COULD reuse the caller's transaction, but the caller currently uses > 1 :-(
174
176
// Or could even do this outside any transaction.
175
177
176
- readOnlyTransaction { tx =>
177
- tx.loadCachedPageContentHtml(pageId, renderParams) foreach { case (cachedHtml, cachedHtmlVersion) =>
178
-
179
- def versionsString = o """ render params: $renderParams,
180
- db cache version: ${cachedHtmlVersion.computerString}
181
- current version: ${currentReactStoreJsonVersion.computerString}"""
182
-
183
- // Here we can compare hash sums of the up-to-date data and the data that was
184
- // used to generate the cached page. We ignore page version and site version.
185
- // Hash sums are always correct, so we'll never rerender unless we actually need to.
186
- if (cachedHtmlVersion.appVersion != currentReactStoreJsonVersion.appVersion ||
187
- cachedHtmlVersion.reactStoreJsonHash != currentReactStoreJsonVersion.reactStoreJsonHash) {
188
- // The browser will make cachedhtml up-to-date by running React.js with up-to-date
189
- // json, so it's okay to return cachedHtml. However, we'd rather send up-to-date
190
- // html, and this page is being accessed, so regenerate html. [4KGJW2]
191
- p.Logger .debug(o """ s $siteId: Page $pageId requested, db cache stale,
192
- will rerender soon, $versionsString [TyMRENDRSOON] """ )
193
- // COULD wait 150 ms for the background thread to finish rendering the page?
194
- // Then timeout and return the old cached page.
195
- globals.renderPageContentInBackground(SitePageId (siteId, pageId), Some (
196
- PageRenderParamsAndHash (renderParams, currentReactStoreJsonVersion.reactStoreJsonHash)))
197
- }
198
- else {
199
- p.Logger .trace(o """ s $siteId: Page found in db cache, reusing: $pageId,
200
- $versionsString [TyMREUSEDB] """ )
201
- }
202
- return (cachedHtml, cachedHtmlVersion)
203
- }
204
- }
205
-
206
- p.Logger .trace(o """ s $siteId: Page not in db cache: $pageId, rendering now..., version:
207
- ${currentReactStoreJsonVersion.computerString} [TyMRENDRNOW] """ )
178
+ // readOnlyTransaction { tx =>
179
+ // tx.loadCachedPageContentHtml(pageId, renderParams) foreach { case (cachedHtml, cachedHtmlVersion) =>
180
+ //
181
+ // def versionsString = o"""render params: $renderParams,
182
+ // db cache version: ${cachedHtmlVersion.computerString}
183
+ // current version: ${currentReactStoreJsonVersion.computerString}"""
184
+ //
185
+ // // Here we can compare hash sums of the up-to-date data and the data that was
186
+ // // used to generate the cached page. We ignore page version and site version.
187
+ // // Hash sums are always correct, so we'll never rerender unless we actually need to.
188
+ // if (cachedHtmlVersion.appVersion != currentReactStoreJsonVersion.appVersion ||
189
+ // cachedHtmlVersion.reactStoreJsonHash != currentReactStoreJsonVersion.reactStoreJsonHash) {
190
+ // // The browser will make cachedhtml up-to-date by running React.js with up-to-date
191
+ // // json, so it's okay to return cachedHtml. However, we'd rather send up-to-date
192
+ // // html, and this page is being accessed, so regenerate html. [4KGJW2]
193
+ // p.Logger.debug(o"""s$siteId: Page $pageId requested, db cache stale,
194
+ // will rerender soon, $versionsString [TyMRENDRSOON]""")
195
+ // // COULD wait 150 ms for the background thread to finish rendering the page?
196
+ // // Then timeout and return the old cached page.
197
+ // globals.renderPageContentInBackground(SitePageId(siteId, pageId), Some(
198
+ // PageRenderParamsAndHash(renderParams, currentReactStoreJsonVersion.reactStoreJsonHash)))
199
+ // }
200
+ // else {
201
+ // p.Logger.trace(o"""s$siteId: Page found in db cache, reusing: $pageId,
202
+ // $versionsString [TyMREUSEDB]""")
203
+ // }
204
+ // return (cachedHtml, cachedHtmlVersion)
205
+ // }
206
+ // }
207
+
208
+ // p.Logger.trace(o"""s$siteId: Page not in db cache: $pageId, rendering now..., version:
209
+ // ${currentReactStoreJsonVersion.computerString} [TyMRENDRNOW]""")
208
210
209
211
// Now we'll have to render the page contents [5KWC58], so we have some html to send back
210
212
// to the client, in case the client is a search engine bot — I suppose those
@@ -215,10 +217,10 @@ trait RenderedPageHtmlDao {
215
217
moreDetails = errorMessage)
216
218
}
217
219
218
- readWriteTransaction { tx =>
219
- tx.upsertCachedPageContentHtml(
220
- pageId, currentReactStoreJsonVersion, currentReactStoreJsonString, newHtml)
221
- }
220
+ // readWriteTransaction { tx =>
221
+ // tx.upsertCachedPageContentHtml(
222
+ // pageId, currentReactStoreJsonVersion, currentReactStoreJsonString, newHtml)
223
+ // }
222
224
223
225
(newHtml, currentReactStoreJsonVersion)
224
226
}
0 commit comments