diff --git a/lib/commands/string.js b/lib/commands/string.js index 1ba0890..400f9fe 100644 --- a/lib/commands/string.js +++ b/lib/commands/string.js @@ -202,16 +202,15 @@ exports.strlen = function(client, key){ */ (exports.setrange = function(client, key, offset, str){ - var key = string(key) - , val = this.data[key] + var obj = this.lookup(string(key)) , offset = +string(offset); - if (null == val) { + if (!obj) { // TODO: finish - } else if ('string' == this.keyType(key)) { - str.copy(val, offset); - client.int(val.length); + } else if ('string' == obj.type) { + str.copy(obj.val, offset); + client.int(obj.val.length); } else { client.typeError(); }