Commit 866b3fc0 authored by Salvatore Sanfilippo's avatar Salvatore Sanfilippo
Browse files

Merge pull request #2357 from lamby/config-set-maxmemory-units

Support "1G" etc. units in CONFIG SET maxmemory
parents 29b54db3 ba74711e
...@@ -643,8 +643,9 @@ void configSetCommand(redisClient *c) { ...@@ -643,8 +643,9 @@ void configSetCommand(redisClient *c) {
zfree(server.masterauth); zfree(server.masterauth);
server.masterauth = ((char*)o->ptr)[0] ? zstrdup(o->ptr) : NULL; server.masterauth = ((char*)o->ptr)[0] ? zstrdup(o->ptr) : NULL;
} else if (!strcasecmp(c->argv[2]->ptr,"maxmemory")) { } else if (!strcasecmp(c->argv[2]->ptr,"maxmemory")) {
if (getLongLongFromObject(o,&ll) == REDIS_ERR || int err;
ll < 0) goto badfmt; ll = memtoll(o->ptr,&err);
if (err || ll < 0) goto badfmt;
server.maxmemory = ll; server.maxmemory = ll;
if (server.maxmemory) { if (server.maxmemory) {
if (server.maxmemory < zmalloc_used_memory()) { if (server.maxmemory < zmalloc_used_memory()) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment