fixes #841 Create a class for the query cache, move it out of Collection
and into querypattern.{cpp,h}