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 6703869
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T07:13:20+00:00 2026-05-26T07:13:20+00:00

right the problem is a smallish one but hope someone can help. Basically we

  • 0

right the problem is a smallish one but hope someone can help.
Basically we use memcache to cache some of our mysql queries and then store the results in an array for memcache. Then when the query runs again it grabs the array results from memcache and processes the results like normal.
So the code looks like this.

$query = "SELECT x,y,z FROM a WHERE b = 3";
$result = mysql_query_run($query,'memcache_name');
while($row = mysql_mem_fetch_array($result,'memcache_name')) {

 //do processing

}

mysql_query_run basically just either runs the query or returns the array from memcache.
The mysql_mem_fetch_array either processes the results from mysql or transverses the array.

The transversing part uses this code.

if(is_array($result)) {
            $return = current($result);
            //get the current result - based on the internal pointer
            next($result);//increment pointed
            return $return;//return result
        }
        else {

            //mysql result tab
            //so get the array from the mysql_fetch_array
            $array = mysql_fetch_array($result);

            if(is_array($MEMCACHE_SERVER_RESULTS[$memcache])==false) {
                //if there is no results then just set the results as array
                $MEMCACHE_SERVER_RESULTS[$memcache] = array();
            }
            //push the array onto the end of the current array - from memcache

            //if there are some results then push them on
            if($single_row == 1) {
                //only one row so just combine the 2 steps and store
                array_push($MEMCACHE_SERVER_RESULTS[$memcache],$array);
                $MEMCACHE_SERVER->set($memcache, $MEMCACHE_SERVER_RESULTS[$memcache],0,$memcache_time);
            }
            else if($array!==false) {

                array_push($MEMCACHE_SERVER_RESULTS[$memcache],$array);
                //and set it
            }
            else {
                //set the memcache to the array that it has been making.
                $MEMCACHE_SERVER->set($memcache, $MEMCACHE_SERVER_RESULTS[$memcache],0,$memcache_time);
            }

            //return array
            return $array;

        }

The problem is the current and next commands – in large arrays (which are very rare) it causes some hanging.
Currently we are in php version 5.1.6 and we are going to 5.3 will the problem be solved?
Or is there a better way to handle the array?
Thanks for your help.
Richard

  • 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-05-26T07:13:21+00:00Added an answer on May 26, 2026 at 7:13 am

    in large arrays (which are very rare) it causes some hanging.

    Easy. Just avoid storing large arrays in memcache.

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

Sidebar

Related Questions

My problem is certainly right on my face but I can't see it... I
So I know you can use output buffer. The problem right now is, I
I have a problem right now, I need to parse an XML but some
I have an interesting thought-problem right now, so maybe someone of you could help.
Hi Guys new to this site but a big fan. Right the problem. It's
Right now i use iText to generate a pdf automatically. And my problem is
I'm facing a strange problem right now... I'm trying to use Facebook API to
I have some unsolved problem right now. My game is done, now I am
I have one irritating problem right now. My tests fail due to an autowire.
I am stuck in a deep problem right now. Plz help me with this....

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.