-
Notifications
You must be signed in to change notification settings - Fork 11
/
redis2.php
39 lines (31 loc) · 900 Bytes
/
redis2.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
<?php
aop_add_after('redis->get()',function($jp){var_dump('aop_add_after',$jp->getArguments());});
aop_add_after('redis2->get()',function($jp){var_dump('aop_add_after',$jp->getArguments());});
class redis2 {
function connect($host){}
function set($key,$val){}
function get($key){}
}
class myredis {
function __construct($redis) {
$this->_redis = $redis;
}
public function __call($name,$args)
{
return call_user_func_array(array($this->_redis, $name), $args);
}
}
$redis = new redis();
$redis->connect('127.0.0.1');
$redis->set('key1',rand());
$redis->get('key1');
$myredis = new myredis($redis);
$myredis->set('key2',rand());
$myredis->get('key2');
$redis2 = new redis2();
$redis2->connect('127.0.0.1');
$redis2->set('key3',rand());
$redis2->get('key3');
$myredis2 = new myredis($redis2);
$myredis2->set('key4',rand());
$myredis2->get('key4');