summaryrefslogtreecommitdiff
path: root/src/t_hash.c
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2018-06-15 13:14:57 +0200
committerantirez <antirez@gmail.com>2019-06-18 12:31:10 +0200
commite9bb30fd859ed4e9e3e6434207dedbc251086858 (patch)
tree0ac8972fefe6911dee8c7376e14c611fcc105e1c /src/t_hash.c
parentfd0ee469ab165d0e005e9fe1fca1c4f5c604cd56 (diff)
downloadredis-new-keyspace.tar.gz
Experimental: new keyspace and expire algorithm.new-keyspace
This is an alpha quality implementation of a new keyspace representation and a new expire algorithm for Redis. This work is described here: https://gist.github.com/antirez/b2eb293819666ee104c7fcad71986eb7
Diffstat (limited to 'src/t_hash.c')
-rw-r--r--src/t_hash.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/t_hash.c b/src/t_hash.c
index bc70e4051..79c6053d8 100644
--- a/src/t_hash.c
+++ b/src/t_hash.c
@@ -449,7 +449,7 @@ sds hashTypeCurrentObjectNewSds(hashTypeIterator *hi, int what) {
}
robj *hashTypeLookupWriteOrCreate(client *c, robj *key) {
- robj *o = lookupKeyWrite(c->db,key);
+ robj *o = lookupKeyWrite(c->db,key,NULL);
if (o == NULL) {
o = createHashObject();
dbAdd(c->db,key,o);
@@ -679,8 +679,8 @@ static void addHashFieldToReply(client *c, robj *o, sds field) {
void hgetCommand(client *c) {
robj *o;
- if ((o = lookupKeyReadOrReply(c,c->argv[1],shared.null[c->resp])) == NULL ||
- checkType(c,o,OBJ_HASH)) return;
+ if ((o = lookupKeyReadOrReply(c,c->argv[1],NULL,shared.null[c->resp]))
+ == NULL || checkType(c,o,OBJ_HASH)) return;
addHashFieldToReply(c, o, c->argv[2]->ptr);
}
@@ -691,7 +691,7 @@ void hmgetCommand(client *c) {
/* Don't abort when the key cannot be found. Non-existing keys are empty
* hashes, where HMGET should respond with a series of null bulks. */
- o = lookupKeyRead(c->db, c->argv[1]);
+ o = lookupKeyRead(c->db, c->argv[1], NULL);
if (o != NULL && o->type != OBJ_HASH) {
addReply(c, shared.wrongtypeerr);
return;
@@ -707,7 +707,7 @@ void hdelCommand(client *c) {
robj *o;
int j, deleted = 0, keyremoved = 0;
- if ((o = lookupKeyWriteOrReply(c,c->argv[1],shared.czero)) == NULL ||
+ if ((o = lookupKeyWriteOrReply(c,c->argv[1],NULL,shared.czero)) == NULL ||
checkType(c,o,OBJ_HASH)) return;
for (j = 2; j < c->argc; j++) {
@@ -734,7 +734,7 @@ void hdelCommand(client *c) {
void hlenCommand(client *c) {
robj *o;
- if ((o = lookupKeyReadOrReply(c,c->argv[1],shared.czero)) == NULL ||
+ if ((o = lookupKeyReadOrReply(c,c->argv[1],NULL,shared.czero)) == NULL ||
checkType(c,o,OBJ_HASH)) return;
addReplyLongLong(c,hashTypeLength(o));
@@ -743,7 +743,7 @@ void hlenCommand(client *c) {
void hstrlenCommand(client *c) {
robj *o;
- if ((o = lookupKeyReadOrReply(c,c->argv[1],shared.czero)) == NULL ||
+ if ((o = lookupKeyReadOrReply(c,c->argv[1],NULL,shared.czero)) == NULL ||
checkType(c,o,OBJ_HASH)) return;
addReplyLongLong(c,hashTypeGetValueLength(o,c->argv[2]->ptr));
}
@@ -772,8 +772,8 @@ void genericHgetallCommand(client *c, int flags) {
hashTypeIterator *hi;
int length, count = 0;
- if ((o = lookupKeyReadOrReply(c,c->argv[1],shared.null[c->resp])) == NULL
- || checkType(c,o,OBJ_HASH)) return;
+ if ((o = lookupKeyReadOrReply(c,c->argv[1],NULL,shared.null[c->resp]))
+ == NULL || checkType(c,o,OBJ_HASH)) return;
/* We return a map if the user requested keys and values, like in the
* HGETALL case. Otherwise to use a flat array makes more sense. */
@@ -817,7 +817,7 @@ void hgetallCommand(client *c) {
void hexistsCommand(client *c) {
robj *o;
- if ((o = lookupKeyReadOrReply(c,c->argv[1],shared.czero)) == NULL ||
+ if ((o = lookupKeyReadOrReply(c,c->argv[1],NULL,shared.czero)) == NULL ||
checkType(c,o,OBJ_HASH)) return;
addReply(c, hashTypeExists(o,c->argv[2]->ptr) ? shared.cone : shared.czero);
@@ -828,7 +828,7 @@ void hscanCommand(client *c) {
unsigned long cursor;
if (parseScanCursorOrReply(c,c->argv[2],&cursor) == C_ERR) return;
- if ((o = lookupKeyReadOrReply(c,c->argv[1],shared.emptyscan)) == NULL ||
- checkType(c,o,OBJ_HASH)) return;
+ if ((o = lookupKeyReadOrReply(c,c->argv[1],NULL,shared.emptyscan))
+ == NULL || checkType(c,o,OBJ_HASH)) return;
scanGenericCommand(c,o,cursor);
}