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

  • SEARCH
  • Home
  • 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 9151493
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T11:48:58+00:00 2026-06-17T11:48:58+00:00

I got a sample Script which looks nearly like this: $memcache = new Memcache;

  • 0

I got a sample Script which looks nearly like this:

$memcache = new Memcache;
$memcache->addServer('memcache_host', 11211);
$memcache->addServer('memcache_host2', 11211);

If i use now

$memcache->set('var_key', 'some really big variable');

The key get/value get stored (only on one server), of course. But when i reorder the Memcache Serverlist, its recreating the cache. I noticed it always use the second Server… But why?

I just want to know and understand, how the hash for storage gets generated.
And which factors are relevant for the hash and server selection?

I could not find anything about.

Regards!

  • 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-17T11:48:59+00:00Added an answer on June 17, 2026 at 11:48 am

    The Answer is:

    crc32($KEY) % Server.length
    

    So in my case, i got 2 Servers with the Sample Key “var_key”.

    crc32(‘var_key’) % 2

    The result is 0. So the first Server is the lucky one!

    crc32(‘var_key_bit_longer_and_longer’) % 2

    In this case the second server (Result is 1) gets chosen.

    As we can see, the following factors are relevant:

    • The Key
    • Server count
    • Order of Server

    That’s the way how the server gets chosen, for standard hash strategy.

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

Sidebar

Related Questions

I've got a simple Visual Basic 2008 Express Edition form which looks like this:
I've got a table which looks like this: <table id=display> <tr class=trigger> <td>Info here</td>
I've got this simple Perl script: #! /usr/bin/perl -w use strict; use Data::Dumper; my
I have got some markup that looks like this: <div class=button> <span class=image></span> <input
I've got a simple function script, the last line of which is to call
I've got a simple script with a lot of formulas like so: $formula =
I've got legacy code sample which uses JFreeChart and XYPlot. Now i'm making i18n
I've got a simple search script which returns results based on a query string
I've got a simple shell script which synchronizes Google Calendars for quick local access.
My directory structure looks like this; folder1 folder2 (thousands of folders like this) folder3

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.