In PHP, can I do this?
$mysql = mysql_connect(...);
Memcache::set('mysql_connection', $mysql);
and then in another scrip开发者_高级运维t
$mysql = Memcache::get('mysql_connection');
mysql_query("some query", $mysql);
?
No, but you can use a pool of permanent connections with mysql_pconnect().
No, it can't. $mysql is actually just a memory pointer to the real MySQL link. The MySQL link is destroyed at the end of the script whether you want it or not, and you are left with a pointer to an undefined place in memory.
加载中,请稍侯......
精彩评论