lib/memcache.rb in memcache-client-1.8.2 vs lib/memcache.rb in memcache-client-1.8.3
- old
+ new
@@ -698,9 +698,10 @@
# Pick a server to handle the request based on a hash of the key.
def get_server_for_key(key, options = {})
raise ArgumentError, "illegal character in key #{key.inspect}" if
key =~ /\s/
+ raise ArgumentError, "key cannot be blank" if key.nil? || key.strip.size == 0
raise ArgumentError, "key too long #{key.inspect}" if key.length > 250
raise MemCacheError, "No servers available" if @servers.empty?
return @servers.first if @servers.length == 1
hkey = hash_for(key)