void CanonicalQuery::generateCacheKey(void) { mongoutils::str::stream ss; encodePlanCacheKeyTree(_root.get(), &ss); encodePlanCacheKeySort(_pq->getSort(), &ss); encodePlanCacheKeyProj(_pq->getProj(), &ss); _cacheKey = ss; }
PlanCacheKey PlanCache::computeKey(const CanonicalQuery& cq) const { str::stream ss; encodePlanCacheKeyTree(cq.root(), &ss); encodePlanCacheKeySort(cq.getParsed().getSort(), &ss); encodePlanCacheKeyProj(cq.getParsed().getProj(), &ss); return ss; }
/** * Cache key is a string-ified combination of the query and sort obfuscated * for minimal user comprehension. */ PlanCacheKey PlanCache::getPlanCacheKey(const CanonicalQuery& query) { stringstream ss; encodePlanCacheKeyTree(query.root(), &ss); encodePlanCacheKeySort(query.getParsed().getSort(), &ss); encodePlanCacheKeyProj(query.getParsed().getProj(), &ss); PlanCacheKey key(ss.str()); return key; }