w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
How should persistent connections be uses with the PECL Memcached plugin for PHP?

Setting same persistent_id for you MemCache server is a normal case when you want a pool of servers.

Example from the doc :

/* Create a persistent instance */
$m2 = new Memcached('story_pool');
$m3 = new Memcached('story_pool');

/* now $m2 and $m3 share the same connection */

Note that even using persistent id you must re-add your servers, see http://php.net/manual/en/memcached.construct.php#93536

See also this important note : http://php.net/manual/en/memcached.construct.php#106865

Your requests are independent. PHP doesn't share its requests. So If you've 2 (or more) requests with the same persistent_id both will live into their own process.

© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.