Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8386465
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T17:56:48+00:00 2026-06-09T17:56:48+00:00

I was looking at the php docs on memcache and noticed that instead of

  • 0

I was looking at the php docs on memcache and noticed that instead of doing
$mem->connect('localhost', 11211) I can do instead
$mem->addServer('localhost', 11211)

And this way if I don’t end up using the memcache connection, it won’t bother connecting.

This got me wondering, why would someone ever use connect() over addServer()?

It just seems like a possible unnecessary connection. Am I missing something?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T17:56:50+00:00Added an answer on June 9, 2026 at 5:56 pm

    connect and pconnect seem to be more low level calls, that perform a single task without much overhead. addServer OTOH is more high level, managing several servers, retrying when one of them fails, etc. I’m under the impression that the latter relies on the former to do its task.

    From the end-user perspective, there’s really little advantage in using the lower level function, except perhaps as a small performance improvement (if you know you’ll use the connection right away, only have a single memcached server and don’t need to keep a persistent connection – or actually wants to reset it for troubleshooting etc – it might be faster to just connect on demand). Only if you need more control over the connection lifecycle (for instance if you’re designing your own caching strategy) those functions will be useful.

    In other words, the fact that those functions are exposed in the API doesn’t imply there will be a common use case for them. Still, it’s often better to provide more tools to interact with a system than less, since it encourages platform building.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm looking for a PHP script that can be run as a cron job
I'm looking at PHP date() documentation and thought that 'I' would tell me whether
I'm looking for a PHP library that allows me to scrap webpages and takes
I am looking for a PHP IDE to work with that contains a design
I was looking at the php.net manual and it had this line of code:
Am I doing this right? I went to look at some old PHP code
I am looking for php script that convert .png file to .icns file for
I'm looking for some help converting this from prototype to jQuery. I'm doing some
I have a sample php script to connect to MSMQ on windows. I can
I'm looking for a PHP script that loops through all of the files in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.