-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
48 lines (35 loc) · 1.32 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
set_time_limit(0);
ini_set('display_errors',1); //错误信息
#ini_set('display_startup_errors',1); //php启动错误信息
error_reporting(E_ALL); //打印出所有的 错误信息
include_once("config.php");
include_once("takeMode.php");
include_once("memcacheClass.php");
include_once("hashMode.php");
$takeObj = new takeMode($config);//takeMode
//实例化memcached
$memcached = new memcacheClass();
//循环插入 1万条
for($i = 0; $i<10000;$i++) {
//数据
$value = 'huangxingchun'.$i;
//放入哪个服务器
$serverNum = $takeObj->setServer($value);
$key = $takeObj->getKey($value);
//链接
$obj = $memcached->connect($takeObj->_config[$serverNum]['host'],$takeObj->_config[$serverNum]['port']);
var_dump($serverNum, $key);
//保存
$set = $memcached->add($key, $value);
//关闭
$memcached->close();
/* var_dump($obj); */
usleep(3000);
}
var_dump($takeObj->_config);
var_dump($takeObj->setServer($takeObj->getKey("huangxingchun1")));
var_dump($takeObj->setServer($takeObj->getKey("huangxingchun2")));
var_dump($takeObj->setServer($takeObj->getKey("huangxingchun3")));
var_dump($takeObj->setServer($takeObj->getKey("huangxingchun4")));
//var_dump($config);