MCPcopy Create free account
hub / github.com/MegEngine/MegEngine / put

Method put

imperative/src/impl/persistent_cache.cpp:82–93  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

80 }
81
82 void put(const std::string& category, const Blob& key, const Blob& value) override {
83 MGB_LOCK_GUARD(m_mtx);
84 std::string key_str(static_cast<const char*>(key.ptr), key.size);
85 std::string redis_key_str;
86 encode(category + '@' + key_str, redis_key_str, 24);
87 std::string value_str(static_cast<const char*>(value.ptr), value.size);
88 std::string redis_value_str;
89 encode(value_str, redis_value_str);
90 auto result = m_client.set(m_prefix + redis_key_str, redis_value_str);
91 m_local->put(category, key, value);
92 sync();
93 }
94
95 std::optional<size_t> clear() override {
96 long long cursor = 0;

Callers 4

TESTFunction · 0.45
setup_algoFunction · 0.45
getMethod · 0.45
putMethod · 0.45

Calls 3

encodeFunction · 0.85
syncFunction · 0.85
setMethod · 0.45

Tested by 1

TESTFunction · 0.36