Batch gets memcache value and press the key, the order of the return code

Source: Internet
Author: User
Tags cas memcached variables return
By memcached getmulti function to batch gets the following 15 ID value.
31639,33878, 177410,9735, 589,12076, 25953,22447, 15368,15358, 33853,26658, 26659,12477, 15366

$ MD-> getmulti ($ arr_id );
The returned sequence:
Line_31639, line_33878, line_177410, line_9735, line_589, line_12076, line_25953, line_22447, line_15368, line_15358, line_33853, line_26658, line_26659, line_12477, line_15366,

A memcache return is correct, in multiple memcache when cannot be one-to-one correspondence in order to return.

When the need to use Memcached: GET_PRESERVE_ORDER to in order to return data:
$ Arrs = $ mem-> getmulti ($ arr_id, $ cas, Memcached :: GET_PRESERVE_ORDER );
The returned sequence:
Line_31639, line_33878, line_9735, line_589, line_22447, line_15358, line_33853, line_26658, line_177410, line_12076, line_25953, line_15368, line_26659, line_12477, line_15366,

This one, if have hit the variable, then $ CAs can play a role. $ CAS returned to the life of the variables, iterate over $ CAS out has hit the variables of the data, and then through the array_diff function and $ arr_id comparison take on a business trip to one by one.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.