Feature/query cache

Here is the basic query-cache implementation. I also tied it into the session serializer so that cached queries will be preserved.