Memcached::__construct

(PECL memcached >= 0.1.0)
Create a Memcached instance
public Memcached::__construct ([ string $persistent_id ] )

Creates a Memcached instance representing the connection to the memcache servers.

Parameters:
persistent_id

By default the Memcached instances are destroyed at the end of the request. To create an instance that persists between requests, use persistent_id to specify a unique ID for the instance. All instances created with the same persistent_id will share the same connection.

Returns:

A Memcached object.

Examples:
Creating a Memcached object
1
2
3
4
5
6
7
8
9
10
11
<?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 */
?>
doc_php
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.