added initial support for caching query plans.