Mercurial > urweb
diff src/monoize.sml @ 2213:365727ff68f4
Complete overhaul: cache queries based on immediate query result, not eventual HTML output.
author | Ziv Scully <ziv@mit.edu> |
---|---|
date | Tue, 14 Oct 2014 18:05:09 -0400 |
parents | 7c2229aa22fc |
children | 794017f378de |
line wrap: on
line diff
--- a/src/monoize.sml Mon Sep 15 20:01:16 2014 -0400 +++ b/src/monoize.sml Tue Oct 14 18:05:09 2014 -0400 @@ -1957,20 +1957,26 @@ (L'.TFun (un, state), loc)), loc)), loc) - val body' = (L'.EApp ( + val body'' = (L'.EApp ( (L'.EApp ( (L'.EApp ((L'.ERel 4, loc), (L'.ERel 1, loc)), loc), (L'.ERel 0, loc)), loc), (L'.ERecord [], loc)), loc) - - val body = (L'.EQuery {exps = exps, - tables = tables, - state = state, - query = (L'.ERel 3, loc), - body = body', - initial = (L'.ERel 1, loc)}, - loc) + val body' = (L'.EQuery {exps = exps, + tables = tables, + state = state, + query = (L'.ERel 3, loc), + body = body'', + initial = (L'.ERel 1, loc)}, + loc) + val (body, fm) = if Settings.getSqlcache () then + let + val (urlifiedRel0, fm) = urlifyExp env fm ((L'.ERel 0, loc), state) + in + (Sqlcache.instrumentQuery (body', urlifiedRel0), fm) + end + else (body', fm) in ((L'.EAbs ("q", s, (L'.TFun (ft, (L'.TFun (state, (L'.TFun (un, state), loc)), loc)), loc), (L'.EAbs ("f", ft, (L'.TFun (state, (L'.TFun (un, state), loc)), loc),