超快速的實現 session on memcache

Posted on 2007-08-22 21:18:56 by darkhero

看文件總是會有新發現...
如果你用的 php, php-memcache 版本夠新...
可以很輕易的將 Session 用 memcached 保存了...

 
session.save_path string

Defines a comma separated of server urls to use for session storage, for example "tcp://host1:11211, tcp://host2:11211".

Each url may contain parameters which are applied to that server, they are the same as for the Memcache::addServer() method. For example "tcp://host1:11211?persistent=1&weight=1&timeout=1&retry_interval=15"


代碼:
<?php
$session_save_path = "tcp://$host:$port?persistent=1&weight=2&timeout=2&retry_interval=10,  ,tcp://$host:$port  ";
ini_set('session.save_handler', 'memcache');
ini_set('session.save_path', $session_save_path);
?>


http://tw.php.net/memcache

Tags: PHP+MySQL PHP網站建構

加入書籤: 收藏這篇文章到HEMiDEMi

迴響

目前沒有人留言.

我要留言!

壹 加 伍 等於