mirror of
https://codeberg.org/redict/redict.git
synced 2025-01-23 08:38:27 -05:00
Merge pull request #5451 from hujiecs/unstable
several typos fixed, optimize MSETNX to avoid unnecessary loop
This commit is contained in:
commit
2f8912c36c
@ -1,7 +1,7 @@
|
|||||||
/* This file implements atomic counters using __atomic or __sync macros if
|
/* This file implements atomic counters using __atomic or __sync macros if
|
||||||
* available, otherwise synchronizing different threads using a mutex.
|
* available, otherwise synchronizing different threads using a mutex.
|
||||||
*
|
*
|
||||||
* The exported interaface is composed of three macros:
|
* The exported interface is composed of three macros:
|
||||||
*
|
*
|
||||||
* atomicIncr(var,count) -- Increment the atomic counter
|
* atomicIncr(var,count) -- Increment the atomic counter
|
||||||
* atomicGetIncr(var,oldvalue_var,count) -- Get and increment the atomic counter
|
* atomicGetIncr(var,oldvalue_var,count) -- Get and increment the atomic counter
|
||||||
|
@ -120,7 +120,7 @@ const char *configEnumGetName(configEnum *ce, int val) {
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Wrapper for configEnumGetName() returning "unknown" insetad of NULL if
|
/* Wrapper for configEnumGetName() returning "unknown" instead of NULL if
|
||||||
* there is no match. */
|
* there is no match. */
|
||||||
const char *configEnumGetNameOrUnknown(configEnum *ce, int val) {
|
const char *configEnumGetNameOrUnknown(configEnum *ce, int val) {
|
||||||
const char *name = configEnumGetName(ce,val);
|
const char *name = configEnumGetName(ce,val);
|
||||||
|
2
src/db.c
2
src/db.c
@ -206,7 +206,7 @@ void dbOverwrite(redisDb *db, robj *key, robj *val) {
|
|||||||
* 2) clients WATCHing for the destination key notified.
|
* 2) clients WATCHing for the destination key notified.
|
||||||
* 3) The expire time of the key is reset (the key is made persistent).
|
* 3) The expire time of the key is reset (the key is made persistent).
|
||||||
*
|
*
|
||||||
* All the new keys in the database should be craeted via this interface. */
|
* All the new keys in the database should be creted via this interface. */
|
||||||
void setKey(redisDb *db, robj *key, robj *val) {
|
void setKey(redisDb *db, robj *key, robj *val) {
|
||||||
if (lookupKeyWrite(db,key) == NULL) {
|
if (lookupKeyWrite(db,key) == NULL) {
|
||||||
dbAdd(db,key,val);
|
dbAdd(db,key,val);
|
||||||
|
@ -123,7 +123,7 @@ static uint8_t intsetSearch(intset *is, int64_t value, uint32_t *pos) {
|
|||||||
} else {
|
} else {
|
||||||
/* Check for the case where we know we cannot find the value,
|
/* Check for the case where we know we cannot find the value,
|
||||||
* but do know the insert position. */
|
* but do know the insert position. */
|
||||||
if (value > _intsetGet(is,intrev32ifbe(is->length)-1)) {
|
if (value > _intsetGet(is,max)) {
|
||||||
if (pos) *pos = intrev32ifbe(is->length);
|
if (pos) *pos = intrev32ifbe(is->length);
|
||||||
return 0;
|
return 0;
|
||||||
} else if (value < _intsetGet(is,0)) {
|
} else if (value < _intsetGet(is,0)) {
|
||||||
|
@ -185,7 +185,7 @@ robj *createStringObjectFromLongDouble(long double value, int humanfriendly) {
|
|||||||
/* Duplicate a string object, with the guarantee that the returned object
|
/* Duplicate a string object, with the guarantee that the returned object
|
||||||
* has the same encoding as the original one.
|
* has the same encoding as the original one.
|
||||||
*
|
*
|
||||||
* This function also guarantees that duplicating a small integere object
|
* This function also guarantees that duplicating a small integer object
|
||||||
* (or a string object that contains a representation of a small integer)
|
* (or a string object that contains a representation of a small integer)
|
||||||
* will always result in a fresh object that is unshared (refcount == 1).
|
* will always result in a fresh object that is unshared (refcount == 1).
|
||||||
*
|
*
|
||||||
|
@ -40,7 +40,7 @@
|
|||||||
* container: 2 bits, NONE=1, ZIPLIST=2.
|
* container: 2 bits, NONE=1, ZIPLIST=2.
|
||||||
* recompress: 1 bit, bool, true if node is temporarry decompressed for usage.
|
* recompress: 1 bit, bool, true if node is temporarry decompressed for usage.
|
||||||
* attempted_compress: 1 bit, boolean, used for verifying during testing.
|
* attempted_compress: 1 bit, boolean, used for verifying during testing.
|
||||||
* extra: 12 bits, free for future use; pads out the remainder of 32 bits */
|
* extra: 10 bits, free for future use; pads out the remainder of 32 bits */
|
||||||
typedef struct quicklistNode {
|
typedef struct quicklistNode {
|
||||||
struct quicklistNode *prev;
|
struct quicklistNode *prev;
|
||||||
struct quicklistNode *next;
|
struct quicklistNode *next;
|
||||||
|
@ -313,6 +313,7 @@ void msetGenericCommand(client *c, int nx) {
|
|||||||
for (j = 1; j < c->argc; j += 2) {
|
for (j = 1; j < c->argc; j += 2) {
|
||||||
if (lookupKeyWrite(c->db,c->argv[j]) != NULL) {
|
if (lookupKeyWrite(c->db,c->argv[j]) != NULL) {
|
||||||
busykeys++;
|
busykeys++;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (busykeys) {
|
if (busykeys) {
|
||||||
|
Loading…
Reference in New Issue
Block a user