MCPcopy Create free account
hub / github.com/ceph/ceph / cacheable_get_python

Method cacheable_get_python

src/mgr/ActivePyModules.cc:214–235  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

212}
213
214PyObject *ActivePyModules::cacheable_get_python(std::string_view what, const bool get_mutable)
215{
216 const bool use_cache =
217 !get_mutable &&
218 api_cache.is_enabled() &&
219 api_cache.is_cacheable(what);
220 if (use_cache) {
221 PyObject* cached = api_cache.get(what);
222 if (cached) {
223 dout(20) << ": api cache hit for " << what << " hit/miss "
224 << api_cache.get_hits() << "/" << api_cache.get_misses()
225 << dendl;
226 return cached;
227 }
228 }
229
230 PyObject *obj = get_python(what, get_mutable);
231 if (use_cache && obj) {
232 api_cache.insert(what, obj);
233 }
234 return obj;
235}
236
237PyObject *ActivePyModules::get_python(std::string_view what, const bool get_mutable)
238{

Callers 1

ceph_state_getFunction · 0.80

Calls 6

is_cacheableMethod · 0.80
get_hitsMethod · 0.80
get_missesMethod · 0.80
is_enabledMethod · 0.45
getMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected