From 723240057a996a64516b10779f754ae26a91d0cd Mon Sep 17 00:00:00 2001 From: antirez Date: Thu, 22 Apr 2010 15:09:07 +0200 Subject: [PATCH] new units for bytes specification --- redis.c | 12 ++++++------ redis.conf | 12 ++++++++++++ 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/redis.c b/redis.c index b3db3f58..8844acc6 100644 --- a/redis.c +++ b/redis.c @@ -989,17 +989,17 @@ static long long memtoll(const char *p, int *err) { while(*u && isdigit(*u)) u++; if (*u == '\0' || !strcasecmp(u,"b")) { mul = 1; - } else if (!strcasecmp(u,"k") || !strcasecmp(u,"kb")) { + } else if (!strcasecmp(u,"k")) { mul = 1000; - } else if (!strcasecmp(u,"ki") || !strcasecmp(u,"kib")) { + } else if (!strcasecmp(u,"kb")) { mul = 1024; - } else if (!strcasecmp(u,"m") || !strcasecmp(u,"mb")) { + } else if (!strcasecmp(u,"m")) { mul = 1000*1000; - } else if (!strcasecmp(u,"mi") || !strcasecmp(u,"mib")) { + } else if (!strcasecmp(u,"mb")) { mul = 1024*1024; - } else if (!strcasecmp(u,"g") || !strcasecmp(u,"hb")) { + } else if (!strcasecmp(u,"g")) { mul = 1000L*1000*1000; - } else if (!strcasecmp(u,"gi") || !strcasecmp(u,"gib")) { + } else if (!strcasecmp(u,"gb")) { mul = 1024L*1024*1024; } else { if (err) *err = 1; diff --git a/redis.conf b/redis.conf index c9ff26cf..909f03bf 100644 --- a/redis.conf +++ b/redis.conf @@ -1,5 +1,17 @@ # Redis configuration file example +# Note on units: when memory size is needed, it is possible to specifiy +# it in the usual form of 1k 5GB 4M and so forth: +# +# 1k => 1000 bytes +# 1kb => 1024 bytes +# 1m => 1000000 bytes +# 1mb => 1024*1024 bytes +# 1g => 1000000000 bytes +# 1gb => 1024*1024*1024 bytes +# +# units are case insensitive so 1GB 1Gb 1gB are all the same. + # By default Redis does not run as a daemon. Use 'yes' if you need it. # Note that Redis will write a pid file in /var/run/redis.pid when daemonized. daemonize no -- 2.45.2