php操作Memcached -- socket

Socket套接字操作 使用的是 memcached-client.php(函数)  下载地址 :http://www.nioxiao.com/wp-content/uploads/2006/04/memcached-client.zip
 
<?php

        require "memcached-client.php";

        $mc = new memcached(array(
               'servers' => array('127.0.0.1:11211'), //如果有多个memcached服务器使用可以使用,号间隔添加
               'debug'   => false,
               'compress_threshold' => 10240,
               'persistant' => true));
 
    $mc->add('key', '顺平');
//    $mc->replace('key', 'some random string');
    $val = $mc->get('key');
        
        echo "key=".$val;
?>

 

posted @ 2013-01-05 13:52  梦话四叶  阅读(175)  评论(0编辑  收藏  举报