MCPcopy Create free account
hub / github.com/OpenAtomFoundation/pikiwidb / SetRange

Method SetRange

tools/pika_migrate/src/cache/src/string.cc:280–297  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

278}
279
280Status RedisCache::SetRange(std::string& key, int64_t start, std::string &value) {
281 if (C_OK != RcFreeMemoryIfNeeded(cache_)) {
282 return Status::Corruption("[error] Free memory faild !");
283 }
284
285 uint64_t ret = 0;
286 robj *kobj = createObject(OBJ_STRING, sdsnewlen(key.data(), key.size()));
287 robj *vobj = createObject(OBJ_STRING, sdsnewlen(value.data(), value.size()));
288 DEFER {
289 DecrObjectsRefCount(kobj, vobj);
290 };
291 int res = RcSetRange(cache_, kobj, start, vobj, reinterpret_cast<unsigned long *>(&ret));
292 if (C_OK != res) {
293 return Status::Corruption("SetRange failed!");
294 }
295
296 return Status::OK();
297}
298
299Status RedisCache::Strlen(std::string& key, int32_t *len) {
300 robj *kobj = createObject(OBJ_STRING, sdsnewlen(key.data(), key.size()));

Callers 3

SetRangexxMethod · 0.45
codis_test.goFile · 0.45
string_test.goFile · 0.45

Calls 2

dataMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected