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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T01:44:10+00:00 2026-05-15T01:44:10+00:00

I have thought a bit recently about how to use getDelayed and getMulti in

  • 0

I have thought a bit recently about how to use getDelayed and getMulti in a PHP application, and their difference.

From reading the documentation about getDelayed:

“The method does not wait for response
and returns right away. When you are
ready to collect the items, call
either Memcached::fetch or
Memcached::fetchAll.”

So obviously there’s a need to call fetchAll before having the keys available, unlike getMulti. But when is the actual memcached call being done?
At fetchAll or when getDelayed is run?

Updated with example:

    $this->memcached->set('int', 99);
    $this->memcached->set('string', 'a simple string');
    $this->memcached->set('array', array(11, 12));

    $this->memcached->getDelayed(array('int'));
    $this->memcached->getDelayed(array('string'));
    $this->memcached->getDelayed(array('array'));

    print("<pre>".print_r( $this->memcached->fetchAll() )."</pre>"); // returns the array element only.
  • 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-15T01:44:11+00:00Added an answer on May 15, 2026 at 1:44 am

    Memcache IO happens on either getDelayed or fetchAll.

    getDelayed basically says “I’m going to want these keys but I don’t need them now”.

    The main benefit of this is it allows PHP to do this in the background as a parallel operation. If you know what keys you’re going to need later on in a process, you can ask PHP to go and get them and when you do need them you call fetchAll.

    If PHP has managed to get the data while it’s been doing other things, when you call fetchAll, there’s no wait. If it hasn’t, the process pauses while the data from Memcached finishes being transferred.

    A very silly example is if you had two things to do:

    1. Resize an image that took 3 seconds.
    2. Get 100 values from a memcache which took 2 seconds.

    If you just resized the image and then used getMulti, it would take 5 seconds.

    If you called getDelayed for your keys, then resized the image and then used fetchAll, the whole thing would take just 3 seconds.

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

Sidebar

Related Questions

I have been reading quite a bit recently about TDD and such and I'm
Thanks for reading this. I would have thought it would be as simple as
I've been looking at some server logs using tail -f recently, and have thought
I have always thought that the terms internationalization and localization (and their funny abbreviations
I would have thought this would be an easy one to Google, but I've
I know, I would have thought the answer was obviously no as well, but
Source RegexOptions.IgnoreCase is more expensive than I would have thought (eg, should be barely
For a long time ago, I have thought that, in java, reversing the domain
I am writing a searching function, and have thought up of this query using
I have always thought that the .equals() method in java should be overridden to

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.