memcachedlibmemcachedlibmemcache

What's the default behavior of memcache for MEMCACHED_BEHAVIOR_NO_BLOCK?


As is stated in the doc

"Default behavior is the library strives to be quick and accurate"

and

MEMCACHED_BEHAVIOR_NO_BLOCK
Causes libmemcached(3) to use asychronous IO. This is the fastest transport available for storage functions.

I want to know if the default value for MEMCACHED_BEHAVIOR_NO_BLOCK is 1?


Solution

  • The default is false, you can verify that with memcached_behavior_get.

    This behavior is not analogous to SO_NONBLOCK/O_NONBLOCK/FIONBIO, because libmemcached always uses non blocking sockets. See here, here and here.

    It might be due to historic reasons, but nowadays it doesn't do more than setting SO_LINGER.