Memcached::__construct
(PECL memcached >= 0.1.0)
Memcached::__construct — Create a Memcached instance
Description
public Memcached::__construct(?string
$persistent_id = null, ?callable $callback = null, ?string $connection_str = null)Creates a Memcached instance representing the connection to the memcache servers.
Warning
This function is currently not documented; only its argument list is available.
Parameters
persistent_idBy default the Memcached instances are destroyed at the end of the request. To create an instance that persists between requests, use
persistent_idto specify a unique ID for the instance. All instances created with the samepersistent_idwill share the same connection.callbackconnection_str
Examples
Example #1 Creating a Memcached object
<?php
/* Create a regular instance */
$m = new Memcached();
echo get_class($m);
/* Create a persistent instance */
$m2 = new Memcached('story_pool');
$m3 = new Memcached('story_pool');
/* now $m2 and $m3 share the same connection */
?>↑ and ↓ to navigate • Enter to select • Esc to close • / to open