0

I am testing out some memcache code here in PHP:

1:

$testInstance = new Memcache;
$var = @$testInstance->connect('localhost', 11211);
echo $var;
// Outputs true no matter if the memcached is running or not.

2:

$testInstance = new Memcache;
$var = @$testInstance->connect('blablabla', 11211);
echo $var;
// Outputs false

Why on earth is this occuring? I am running WinXP in my development environment and I cant see how the localhost version always returns true no matter if the memcached is running or not.

Thanks!

2
  • may be there is some host named "blablabla" with memcache running around? :)~ Commented May 22, 2010 at 12:23
  • I dont know if I would be happy or not to find that out :) Commented May 22, 2010 at 12:47

2 Answers 2

1

Are you sure that memcache is not running on localhost? Maybe it is alive in the background as system service? Put something in and see if you can retrieve it.

Sign up to request clarification or add additional context in comments.

1 Comment

To answer your question, Nope, memcached is not running in the background. I also tried to connect to a cloud EC2 instance which at that time were offline. It did not return false!
0

The issue went away when i switched to run memcached (not memcache) on a Ubuntu server instead. Really strange...

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.