MCPcopy Create free account
hub / github.com/F-Stack/f-stack / dbUnshareStringValue

Function dbUnshareStringValue

app/redis-6.2.6/src/db.c:366–375  ·  view source on GitHub ↗

Prepare the string object stored at 'key' to be modified destructively * to implement commands like SETBIT or APPEND. * * An object is usually ready to be modified unless one of the two conditions * are true: * * 1) The object 'o' is shared (refcount > 1), we don't want to affect * other users. * 2) The object encoding is not "RAW". * * If the object is found in one of the above condi

Source from the content-addressed store, hash-verified

364 * using an sdscat() call to append some data, or anything else.
365 */
366robj *dbUnshareStringValue(redisDb *db, robj *key, robj *o) {
367 serverAssert(o->type == OBJ_STRING);
368 if (o->refcount != 1 || o->encoding != OBJ_ENCODING_RAW) {
369 robj *decoded = getDecodedObject(o);
370 o = createRawStringObject(decoded->ptr, sdslen(decoded->ptr));
371 decrRefCount(decoded);
372 dbOverwrite(db,key,o);
373 }
374 return o;
375}
376
377/* Remove all keys from the database(s) structure. The dbarray argument
378 * may not be the server main DBs (could be a backup).

Callers 9

setrangeCommandFunction · 0.85
appendCommandFunction · 0.85
pfaddCommandFunction · 0.85
pfcountCommandFunction · 0.85
pfmergeCommandFunction · 0.85
pfdebugCommandFunction · 0.85
RM_StringDMAFunction · 0.85
RM_StringTruncateFunction · 0.85

Calls 5

getDecodedObjectFunction · 0.85
createRawStringObjectFunction · 0.85
sdslenFunction · 0.85
decrRefCountFunction · 0.85
dbOverwriteFunction · 0.85

Tested by

no test coverage detected