首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

Memcached::__construct

(PECL memcached >= 0.1.0)

Memcached::__construct — Create a Memcached instance

Description

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.

Return Values

A Memcached object.

Examples

Example #1 Creating a Memcached object

代码语言:javascript
复制
<?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?*/
?>

← Memcached::casByKey

Memcached::decrement →

代码语言:txt
复制
 ? 1997–2017 The PHP Documentation Group

Licensed under the Creative Commons Attribution License v3.0 or later.

扫码关注腾讯云开发者

领取腾讯云代金券

http://www.vxiaotou.com