Question

I am having a problem on my local machine when I am doing testing. I have a pool of memcached servers that my PHP code is trying to access. Thing is, these are private IPs so my local box's code doesn't have access to them.

The problem I'm having is that the getDelayed() call hangs for 8 seconds waiting for a connection locally. Is there anywhere to adjust the timeout period?

Why does it even need to wait for a connection before returning? My understanding was that getDelayed() was supposed to be an asynchronous call but control is not yielding back from the function until it times out.

Was it helpful?

Solution

Reposting my comment from above so I can mark this post as answered:

Found the option I needed to change. It was OPT_CONNECT_TIMEOUT I changed it to 10 but still need to do some testing on our private network to see if that is too low for actual use. But it fixed the problems on my development box.

self::$memcache->setOption(Memcached::OPT_CONNECT_TIMEOUT, 10);

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top