shendongming/php-redis-cache

PHP Redis 缓存,一致性哈希,封装 phpredis

dev-master 2015-04-10 14:56 UTC

This package is not auto-updated.

Last update: 2024-09-28 16:40:02 UTC


README

PHP Redis 缓存,一致性哈希,封装 phpredis

<?     

/*
   test result
   ....................................................................................................
   ..**...**...**.***...****.*...**.....**...*.*.*.*.*........*.**.*..*...*..*....**.*..**..**.***.*..*
   **..***..***..*...***....*.***..*****..***.*.*.*.*.********.*..*.**.***.**.****..*.**..**..*...*.**.
*/
   
   
include_once __DIR__ . '/vendor/autoload.php';



function test4_set1()
{
    $conf = array(
        'cluster' => array('127.0.0.1:7001', '127.0.0.1:7000'),
    );
    $cache = new RedisCache($conf);
    $t1 = microtime(1);

    for ($i = 0; $i < 10000; $i++) {
        $cache->set('qw' . $i, 'hello' . $i);
    }

    $t2 = microtime(1);

    var_dump($t2 - $t1);
    echo "\n";
}