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
| 364 | * using an sdscat() call to append some data, or anything else. |
| 365 | */ |
| 366 | robj *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). |
no test coverage detected