You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
hrm... there is no way to get a null for an existing key, only an empty string. In the memcache protocol, it is possible to set a key to the empty string (""), but not to null.
Some libraries, like Dalli for Ruby, actually serialize all values, so Ruby's nil get's serialized to the bytestring "\x04\b0". So the actual value from the perspective of memcache is non-null. MemJs is, by design, as close to the protocol as possible---you can put whatever layer on top you want.
None-the-less, I'm not sure there's any harm in also setting the err to "key not found", so I'm happy to take a pull request.
in node console
$ var memjs = require('memjs')
$ var client = memjs.Client.create()
$ client.get('hello', function(err, val) { console.log("err:"+err+" - val:"+val); })
$ err:null - world
$ client.get('nohello', function(err, val) { console.log("err:"+err+"- val:"+val); })
$ err:null - null
Assuming that 'hello' was set to 'world'
First call works as advertized
Second call should fail. It returns no data and err is not set.
??
Would be nicer to return "key not found" error.
There is a big difference with a key not found and a key set to null.
Thanks,
Pat
The text was updated successfully, but these errors were encountered: