added support for caching query plans.