遍历Memcached服务器的KEY列表
Memcached.ClientLibrary没有提供获取所有缓存KEY的方法,但有时候,我们又需要得知当前Memcached服务器上有哪些缓存key。
于是,我修改了Memcached.ClientLibrary源代码,实现了该需求。
主要通过发送stats items命令和stats cachedump x x来实现,可以先telnet上去看看
摸黑输入 stats items回车
面朝大海,春暖花开
Memcached.ClientLibrary没有提供获取所有缓存KEY的方法,但有时候,我们又需要得知当前Memcached服务器上有哪些缓存key。
于是,我修改了Memcached.ClientLibrary源代码,实现了该需求。
主要通过发送stats items命令和stats cachedump x x来实现,可以先telnet上去看看
摸黑输入 stats items回车
昨天安装的win7 rtm 7600.16385,这个是win7 rtm的最终版本了,值得一试。
安装完成后,装上apache2与mysql均一切顺利,配置好httpd.conf,加载php5apache2模块后,启动apache失败,日志如下:
[Sun Jul 19 17:05:55 2009] [warn] pid file I:/win7_amp/Apache2/logs/httpd.pid overwritten — Unclean shutdown of previous Apache run?
[Sun Jul 19 17:06:00 2009] [warn] pid file I:/win7_amp/Apache2/logs/httpd.pid overwritten — Unclean shutdown of previous Apache run?
[Sun Jul 19 17:06:04 2009] [warn] pid file I:/win7_amp/Apache2/logs/httpd.pid overwritten — Unclean shutdown of previous Apache run?
[Sun Jul 19 19:00:56 2009] [warn] pid file I:/win7_amp/Apache2/logs/httpd.pid overwritten — Unclean shutdown of previous Apache run?
注释掉LoadModule php5_module I:/win7_amp/php/php5apache2_2.dll后就能顺利启动,看来是加载这个模块后出了问题。但是我未能找到解决办法,以后在win7 rc 7100中都能正常使用:(,不知道有没有朋友和我一样遇到此类问题。
google httpd.pid overwritten — Unclean shutdown of previous Apache run?后倒是有些发现,但大家都是删除httpd.pid这个文件后重启就OK了,win7下无效。
模仿一个runcode插件改写的,wp的插件写起来还是比较简单的。
播放器是用豆瓣的,你要不喜欢可以换成别的,就需要自己改代码了。
调用方法【mp3】xxxxx【/mp3】,全角换成半角的就行了。
代码如下:
<?php
/*
Plugin Name: mp3player
Plugin URI: http://www.yibin001.com/archives/6348
Description: mp3player in a post
Version: 1.0
Author: yibin
Author URI: http://www.yibin001.com
*/
$player = new player();
add_filter('the_content', array(&$player, 'convert'), -500);
unset($player);
class player
{
function __builderplayer($url) {
if(empty($url)) return '';
return sprintf('<p><embed src="http://www.douban.com/swf/player.swf?url=%s&amp;autoplay=0" type="application/x-shockwave-flash" wmode="transparent" allowscriptaccess="always" width="400" height="80" /></p>',$url);
}
function convert($content)
{
$str_pattern = "/\[mp3\](.*?)\[\/mp3\]/i";
$content = preg_replace($str_pattern,$this->__builderplayer('\\1'),$content);
return $content;
}
}
?>
上传到wp的插件目录,然后在后台启用就行了
操作cdb_sessions表,发现大量的locked,直接后果就是mysql无法响应WEB的请求,WEB无法响应浏览器端的请求。
太壮观:
+-------+------+-----------+--------+---------+------+--------+------------------------------------------------------------------------------------------------------+
| Id | User | Host | db | Command | Time | State | Info |
+-------+------+-----------+--------+---------+------+--------+------------------------------------------------------------------------------------------------------+
| 84082 | root | localhost | discuz | Query | 54 | update | INSERT INTO cdb_sessions (sid, ip1, ip2, ip3, ip4, uid, username, groupid, styleid, invisible, acti |
| 84083 | root | localhost | discuz | Query | 54 | Locked | DELETE FROM cdb_sessions WHERE sid='Z71z19' OR lastactivity<(1245657270-900) OR ('0'<>'0' AND uid=' |
| 84084 | root | localhost | discuz | Query | 54 | Locked | SELECT uid, username, groupid, invisible, action, lastactivity, fid FROM cdb_sessions WHERE uid <> 0 |
| 84086 | root | localhost | discuz | Query | 54 | Locked | SELECT uid, username, groupid, invisible, action, lastactivity, fid FROM cdb_sessions WHERE uid <> 0 |
| 84085 | root | localhost | discuz | Query | 54 | Locked | SELECT uid, username, groupid, invisible, action, lastactivity, fid FROM cdb_sessions WHERE uid <> 0 |
| 84087 | root | localhost | discuz | Query | 54 | Locked | SELECT uid, username, groupid, invisible, action, lastactivity, fid FROM cdb_sessions WHERE uid <> 0 |
| 84088 | root | localhost | discuz | Query | 54 | Locked | SELECT uid, username, groupid, invisible, action, lastactivity, fid FROM cdb_sessions WHERE uid <> 0 |
| 84089 | root | localhost | discuz | Query | 54 | Locked | SELECT uid, username, groupid, invisible, action, lastactivity, fid FROM cdb_sessions WHERE uid <> 0 |
| 84090 | root | localhost | discuz | Query | 54 | Locked | SELECT uid, username, groupid, invisible, action, lastactivity, fid FROM cdb_sessions WHERE uid <> 0 |
| 84091 | root | localhost | discuz | Query | 54 | Locked | SELECT uid, username, groupid, invisible, action, lastactivity, fid FROM cdb_sessions WHERE uid <> 0 |
| 84092 | root | localhost | discuz | Query | 54 | Locked | SELECT uid, username, groupid, invisible, action, lastactivity, fid FROM cdb_sessions WHERE uid <> 0 |
| 84093 | root | localhost | discuz | Query | 54 | Locked | DELETE FROM cdb_sessions WHERE sid='wsX92s' OR lastactivity<(1245657270-900) OR ('0'<>'0' AND uid=' |
| 84095 | root | localhost | discuz | Query | 54 | Locked | SELECT uid, username, groupid, invisible, action, lastactivity, fid FROM cdb_sessions WHERE uid <> 0 |
| 84096 | root | localhost | discuz | Query | 54 | Locked | DELETE FROM cdb_sessions WHERE sid='Ra5ZqL' OR lastactivity<(1245657270-900) OR ('0'<>'0' AND uid=' |
| 84094 | root | localhost | discuz | Query | 54 | Locked | SELECT uid, username, groupid, invisible, action, lastactivity, fid FROM cdb_sessions WHERE uid <> 0 |
| 84097 | root | localhost | discuz | Query | 54 | Locked | SELECT sid, uid AS sessionuid, groupid, groupid='6' AS ipbanned, pageviews AS spageviews, styleid, l |
| 84100 | root | localhost | discuz | Query | 54 | Locked | SELECT sid, uid AS sessionuid, groupid, groupid='6' AS ipbanned, pageviews AS spageviews, styleid, l |
| 84099 | root | localhost | discuz | Query | 54 | Locked | SELECT uid, username, groupid, invisible, action, lastactivity, fid FROM cdb_sessions WHERE uid <> 0 |
最为BT的是,这些locked形成之后,必须重启mysql才行