mirror of
https://github.com/fluencelabs/redis
synced 2025-06-13 01:01:22 +00:00
added a new hvstrlen command
the hvstrlen command returns the length of a hash field value
This commit is contained in:
14
src/t_hash.c
14
src/t_hash.c
@ -685,6 +685,20 @@ void hlenCommand(redisClient *c) {
|
||||
addReplyLongLong(c,hashTypeLength(o));
|
||||
}
|
||||
|
||||
void hvstrlenCommand(redisClient *c) {
|
||||
robj *o;
|
||||
robj *value;
|
||||
if ((o = lookupKeyReadOrReply(c,c->argv[1],shared.nullbulk)) == NULL ||
|
||||
checkType(c,o,REDIS_HASH)) return;
|
||||
|
||||
if ((value = hashTypeGetObject(o,c->argv[2])) == NULL) {
|
||||
addReply(c, shared.nullbulk);
|
||||
} else {
|
||||
addReplyLongLong(c,stringObjectLen(value));
|
||||
decrRefCount(value);
|
||||
}
|
||||
}
|
||||
|
||||
static void addHashIteratorCursorToReply(redisClient *c, hashTypeIterator *hi, int what) {
|
||||
if (hi->encoding == REDIS_ENCODING_ZIPLIST) {
|
||||
unsigned char *vstr = NULL;
|
||||
|
Reference in New Issue
Block a user