Bugs: Browse | Submit New | Admin
The offending line: command = "set #{cache_key} 0 #{expiry} #{value.size}\r\n#{value}\r\n" The problem is the length part of the set command is done on it's pre-string form and not after conversion even though it will be converted to a string before being sent to the server. For example: CACHE.set('test', 1, 1, true) value.size == 1.size == 4 value.to_s.size == 1.to_s.size == 1 => set test 0 1 4 1 The server ends up waiting for 3 more bytes that never come.
Add A Comment:
Date: 2007-09-08 04:34 Sender: Eric Hodel Ok, I will consider it.
Date: 2007-09-08 04:18 Sender: Elijah Miller Since to_s is called on value already, is there any harm in calling it before the size call? I think this behavior is preferable to never returning memcache calls. If you still disagree then I think these methods should an error on non string values.
Date: 2007-09-08 03:43 Sender: Eric Hodel It is not broken. Raw mode is for String values only. Don't supply non-string values when raw is true.