MCPcopy Create free account
hub / github.com/PaddlePaddle/Serving / Get

Method Get

core/predictor/framework/request_cache.cpp:59–79  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

57}
58
59int RequestCache::Get(const Request& req, Response* res, uint64_t* key) {
60 if (!Enabled()) {
61 return -1;
62 }
63 uint64_t local_key = 0;
64 Hash(req, &local_key);
65 if (key != nullptr) {
66 *key = local_key;
67 }
68 std::lock_guard<std::recursive_mutex> lk(cache_mtx_);
69 auto iter = map_.find(local_key);
70 if (iter == map_.end()) {
71 LOG(INFO) << "key not found in cache";
72 return -1;
73 }
74 auto entry = iter->second;
75 BuildResponse(entry, res);
76 UpdateLru(local_key);
77
78 return 0;
79}
80
81int RequestCache::Put(const Request& req, const Response& res, uint64_t* key) {
82 if (!Enabled()) {

Callers

nothing calls this directly

Calls 2

findMethod · 0.80
endMethod · 0.45

Tested by

no test coverage detected