Introduce per-version QueryCache

o This avoids allocating pairs of (version, query)
o This avoids allocating lambdas in prepare for compiler-2.1
Merge pull request #2010 from boggle/2.1-query-cache

Introduce per-version QueryCache