summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2016-07-18 10:56:11 +0200
committerantirez <antirez@gmail.com>2016-07-18 10:56:47 +0200
commit24dd4a8f0444377af55cb1842ff0cfd5a8f74788 (patch)
treec9a98871e226fafb62402d77e9e2da52c06aa9cc
parentb8450d7cc515a55f0e1278f70806c12cb6d9fa58 (diff)
downloadredis-24dd4a8f0444377af55cb1842ff0cfd5a8f74788.tar.gz
redis-cli LRU test mode: randomize value of key when setting.
This way it is possible from an observer to tell when the key is replaced with a new one having the same name.
-rw-r--r--src/redis-cli.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/redis-cli.c b/src/redis-cli.c
index 7010e5e5a..d1735d638 100644
--- a/src/redis-cli.c
+++ b/src/redis-cli.c
@@ -2424,8 +2424,11 @@ static void LRUTestMode(void) {
while(mstime() - start_cycle < 1000) {
/* Write cycle. */
for (j = 0; j < LRU_CYCLE_PIPELINE_SIZE; j++) {
+ char val[6];
+ val[5] = '\0';
+ for (int i = 0; i < 5; i++) val[i] = 'A'+rand()%('z'-'A');
LRUTestGenKey(key,sizeof(key));
- redisAppendCommand(context, "SET %s val",key);
+ redisAppendCommand(context, "SET %s %s",key,val);
}
for (j = 0; j < LRU_CYCLE_PIPELINE_SIZE; j++)
redisGetReply(context, (void**)&reply);