iterates through plan cache from front to back of the cache(queue) A valid shared_ptr of the plan in the cache is returned if found, and empty share_ptr otherwise.
| 43 | // A valid shared_ptr of the plan in the cache is returned |
| 44 | // if found, and empty share_ptr otherwise. |
| 45 | plan_t find(const std::string& key) const { |
| 46 | std::shared_ptr<P> res; |
| 47 | |
| 48 | for (unsigned i = 0; i < mCache.size(); ++i) { |
| 49 | if (key == mCache[i].first) { |
| 50 | res = mCache[i].second; |
| 51 | break; |
| 52 | } |
| 53 | } |
| 54 | |
| 55 | return res; |
| 56 | } |
| 57 | |
| 58 | // pushes plan to the front of cache(queue) |
| 59 | void push(const std::string key, plan_t plan) { |
no outgoing calls
no test coverage detected