diff options
author | Ziv Scully <ziv@mit.edu> | 2015-05-06 23:11:30 -0400 |
---|---|---|
committer | Ziv Scully <ziv@mit.edu> | 2015-05-06 23:11:30 -0400 |
commit | ca3efa1458583772a9826198ed4b99eec381f2de (patch) | |
tree | 601805ceb6fea9d5d9282a2b2f51857b416e8f23 /src/sqlcache.sml | |
parent | 9c155aa780bef9e6edae2c07516693c12b37962b (diff) |
More work factoring out Sqlcache back end.
Diffstat (limited to 'src/sqlcache.sml')
-rw-r--r-- | src/sqlcache.sml | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/sqlcache.sml b/src/sqlcache.sml index 931c6737..3082904c 100644 --- a/src/sqlcache.sml +++ b/src/sqlcache.sml @@ -1,4 +1,4 @@ -structure Sqlcache (* :> SQLCACHE *) = struct +structure Sqlcache :> SQLCACHE = struct open Mono @@ -39,6 +39,10 @@ val ffiEffectful = andalso not (m = "Basis" andalso SS.member (fs, f)) end +val cache = ref ToyCache.cache +fun setCache c = cache := c +fun getCache () = !cache + (* Effect analysis. *) @@ -366,6 +370,8 @@ val tableDml = (* Program instrumentation. *) +val {check, store, flush, ...} = getCache () + val dummyLoc = ErrorMsg.dummySpan fun stringExp s = (EPrim (Prim.String (Prim.Normal, s)), dummyLoc) @@ -400,8 +406,8 @@ fun cacheWrap (query, i, urlifiedRel0, resultTyp, args) = (* We ensure before this step that all arguments aren't effectful. by turning them into local variables as needed. *) val argsInc = map (incRels 1) args - val check = (ToyCache.check (i, args), dummyLoc) - val store = (ToyCache.store (i, argsInc, urlifiedRel0), dummyLoc) + val check = (check (i, args), dummyLoc) + val store = (store (i, argsInc, urlifiedRel0), dummyLoc) val rel0 = (ERel 0, loc) in ECase (check, @@ -545,7 +551,7 @@ fun invalidations ((query, numArgs), dml) = fun addFlushing (file, (tableToIndices, indexToQueryNumArgs, _)) = let val flushes = List.concat o - map (fn (i, argss) => map (fn args => ToyCache.flush (i, args)) argss) + map (fn (i, argss) => map (fn args => flush (i, args)) argss) val doExp = fn EDml (origDmlText, failureMode) => let |