fix query cache clearing

fixes CNVS-12995

need to keep a per-thread list of query caches, so they can all be
cleared at once

Change-Id: Id40b587f91e20ccef11e3f68c97b3b60b9f777ce
Reviewed-on: https://gerrit.instructure.com/34949
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: James Williams  <jamesw@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>