From 6f864e62661637917ce6b449ae2c5e11538dfa1f Mon Sep 17 00:00:00 2001 From: antirez Date: Thu, 23 Apr 2009 18:46:11 +0200 Subject: [PATCH 1/1] dictGetRandomKey bug fixed, RANDOMKEY will not block the server anymore --- Changelog | 6 ++++++ client-libraries/php/redis.php | 6 ++++++ dict.c | 2 +- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/Changelog b/Changelog index d3d4f6c5..e470cd07 100644 --- a/Changelog +++ b/Changelog @@ -1,3 +1,9 @@ +2009-04-22 FLUSHALL/FLUSHDB no longer sync on disk. Just increment the dirty counter by the number of elements removed, that will probably trigger a background saving operation +2009-04-21 forgot to comment testing code in PHP lib. Now it is ok +2009-04-21 PHP client ported to PHP5 and fixed +2009-04-21 doc update +2009-04-20 Non blocking replication (finally!). C-side linked lists API improved. +2009-04-19 SUNION, SUNIONSTORE, Initial work on non blocking replication 2009-04-10 Redis 0.091 released 2009-04-10 SINTER/SINTERSTORE/SLEMENTS fix: misisng keys are now not errors, but just like empty sets 2009-04-09 doc changes diff --git a/client-libraries/php/redis.php b/client-libraries/php/redis.php index 1e582d24..6a0d21be 100644 --- a/client-libraries/php/redis.php +++ b/client-libraries/php/redis.php @@ -68,6 +68,12 @@ class Redis { $this->write("GET $name\r\n"); return $this->get_response(); } + + public function mget($keys) { + $this->connect(); + $this->write("MGET ".implode(" ",$keys)."\r\n"); + return $this->get_response(); + } public function incr($name, $amount=1) { $this->connect(); diff --git a/dict.c b/dict.c index 4e740e7d..9360d52e 100644 --- a/dict.c +++ b/dict.c @@ -377,7 +377,7 @@ dictEntry *dictGetRandomKey(dict *ht) unsigned int h; int listlen, listele; - if (ht->size == 0) return NULL; + if (ht->used == 0) return NULL; do { h = random() & ht->sizemask; he = ht->table[h]; -- 2.45.2