From 24dd4a8f0444377af55cb1842ff0cfd5a8f74788 Mon Sep 17 00:00:00 2001 From: antirez Date: Mon, 18 Jul 2016 10:56:11 +0200 Subject: [PATCH] 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. --- src/redis-cli.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/redis-cli.c b/src/redis-cli.c index 7010e5e5..d1735d63 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);