<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>邪罗刹的菠萝阁 &#187; cache</title>
	<atom:link href="http://www.rainmoe.com/tag/cache/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.rainmoe.com</link>
	<description>One code, one world ...</description>
	<lastBuildDate>Thu, 29 Dec 2011 14:04:21 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>WP-Gravatar-Mini-Cache_V1.0.2插件更新</title>
		<link>http://www.rainmoe.com/2010/10/18/wp-gravatar-mini-cache-v102/</link>
		<comments>http://www.rainmoe.com/2010/10/18/wp-gravatar-mini-cache-v102/#comments</comments>
		<pubDate>Sun, 17 Oct 2010 19:53:08 +0000</pubDate>
		<dc:creator>小邪</dc:creator>
				<category><![CDATA[作品 [Work]]]></category>
		<category><![CDATA[cache]]></category>
		<category><![CDATA[gravatar]]></category>
		<category><![CDATA[plugin]]></category>

		<guid isPermaLink="false">http://www.evlos.org/?p=2090</guid>
		<description><![CDATA[> 此文是关于 WP-Gravatar-Mini-Cache V1.0.2 相关文章，听说国内无法访问 Gravatar CDN 服务器。

> 然后是一个关于 WP-Gravatar-Mini-Cache V1.0.3 的新思路，但是小邪不知道效果怎样，请求测试。



<span class="readmore"><a href="http://www.rainmoe.com/2010/10/18/wp-gravatar-mini-cache-v102/" title="WP-Gravatar-Mini-Cache_V1.0.2插件更新">阅读全文——共6466字</a></span>]]></description>
			<content:encoded><![CDATA[<p>> 此文是关于 WP-Gravatar-Mini-Cache V1.0.2 相关文章，听说国内无法访问 Gravatar CDN 服务器。<br />
> 然后是一个关于 WP-Gravatar-Mini-Cache V1.0.3 的新思路，但是小邪不知道效果怎样，请求测试。</p>
<p><img src="http://www.rainmoe.com/wp-content/uploads/2010/10/Cap0001935a.png" alt="" title="" width="600" height="278" class="alignnone size-full wp-image-2099" /></p>
<p><span id="more-2090"></span><strong>一. WP-Gravatar-Mini-Cache V1.0.2：</strong></p>
<p>> 官网托管地址 - <a target='_blank' rel='nofollow' href='http://wordpress.org/extend/plugins/wp-gravatar-mini-cache/'>http://wordpress.org/extend/plugins/wp-gravatar-mini-cache</a></p>
<p><img src="http://www.rainmoe.com/wp-content/uploads/2010/10/Cap0001935b.png" alt="" title="" width="600" height="205" class="alignnone size-full wp-image-2099" /></p>
<p><strong>二. WP-Gravatar-Mini-Cache 的由来声明：</strong></p>
<p>> 那个，小邪觉得应该稍微解释一下这个<em>头像缓存插件的由来</em>，不然总是感觉有点尴尬的说。╮( -'`-; )╭。<br />
> 因为看到很多盆友在<em>插件出问题的时候去找Willin大湿解决，其实这是小邪的问题，不该麻烦大湿的</em>。</p>
<p>> 话说 WP-Gravatar-Mini-Cache v1.0.0 起源于最初 Willin大湿 的《簡易的 Gravatar 頭像緩存》。<br />
> 由于当时未使用 HOOK 方式，所以小邪加上了 HOOK，然后使用正则等方法来处理数据输入输出。</p>
<pre class="brush: php; auto-links: false; html-script: false; title: ; notranslate">
//下面的是最初大湿的那段代码，引用位置在 - http://kan.willin.org/?p=1277
$f = md5(strtolower($comment-&gt;comment_author_email));
$a = get_bloginfo('wpurl'). '/avatar/'. $f. '.jpg';
$e = ABSPATH. 'avatar/'. $f. '.jpg';
$t = 1209600; //設定14天, 單位:秒
$d = get_bloginfo('wpurl'). '/avatar/default.jpg';
if ( !is_file($e) || (time() - filemtime($e)) &gt; $t ){ //頭像不存在或文件超過14天才更新
  $r = get_option('avatar_rating');
  $g = 'http://www.gravatar.com/avatar/'. $f. '?s=50&amp;d='. $d. '&amp;r='.$r;
  copy($g, $e); $a = esc_attr($g); //新頭像 copy 時, 取 gravatar 顯示
}
if (filesize($e) &lt; 500) copy($d, $e);
</pre>
<p>> 然后 Willin大湿 发布了《新版 Gravatar 緩存》，在这里面添加了 Hook 方法，就小邪当初目的一致了。<br />
> 而且大湿重新优化了这段代码，使用很巧妙的方式来处理数据的输入输出，这是大家普遍使用的版本。<br />
> 但到这个<em>新版本这，就和小邪的插件木有关系了</em>噢。小邪的插件在后面进行了代码功能调整之类的动作。<br />
> 所以插件如果出问题，请大家不要去找 Willin 大湿，<em>大湿要郁闷的呢</em>。</p>
<pre class="brush: php; auto-links: false; html-script: false; title: ; notranslate">
//下面是大湿升级之后的代码，引用位置在 - http://kan.willin.org/?p=1320
function my_avatar($avatar) {
  $tmp = strpos($avatar, 'http');
  $g = substr($avatar, $tmp, strpos($avatar, &quot;'&quot;, $tmp) - $tmp);
  $tmp = strpos($g, 'avatar/') + 7;
  $f = substr($g, $tmp, strpos($g, &quot;?&quot;, $tmp) - $tmp);
  $w = get_bloginfo('wpurl');
  $e = ABSPATH .'avatar/'. $f .'.jpg';
  $t = 1209600; //設定14天, 單位:秒
  if ( !is_file($e) || (time() - filemtime($e)) &gt; $t ) { //當頭像不存在或文件超過14天才更新
    copy(htmlspecialchars_decode($g), $e);
  } else  $avatar = strtr($avatar, array($g =&gt; $w.'/avatar/'.$f.'.jpg'));
  if (filesize($e) &lt; 500) copy($w.'/avatar/default.jpg', $e);
  return $avatar;
}
add_filter('get_avatar', 'my_avatar');
</pre>
<p>> 下面是小邪插件的核心代码，最近在 v1.0.2 发布的时候又进行了部分的优化，祝大家用的愉快，呵呵。</p>
<pre class="brush: php; auto-links: false; html-script: false; title: ; notranslate">
function get_cavatar($source) {
	$time = 1209600;
	preg_match('/avatar\/([a-z0-9]+)\?s=(\d+)/',$source,$tmp);
	$abs = ABSPATH.'wp-content/plugins/wp-gravatar-mini-cache/iava/'.$tmp[1].'.jpg';
	$url = get_bloginfo('wpurl').'/wp-content/plugins/wp-gravatar-mini-cache/iava/'.$tmp[1].'.jpg';
	$default = get_bloginfo('wpurl').'/wp-content/plugins/wp-gravatar-mini-cache/iava/'.'default.jpg';
	if (!is_file($abs)||(time()-filemtime($abs))&gt;$time){
		copy('http://www.gravatar.com/avatar/'.$tmp[1].'?s=64&amp;d='.$ava_default.'&amp;r=G',$abs);
	}
	if (filesize($abs)&lt;500) { copy($default,$abs); }
	return '&lt;img alt=&quot;&quot; src=&quot;'.$url.'&quot; class=&quot;avatar avatar-'.$tmp[2].'&quot; width=&quot;'.$tmp[2].'&quot; height=&quot;'.$tmp[2].'&quot; /&gt;';
}
add_filter('get_avatar','get_cavatar');
</pre>
<p><strong>三. 一个新思路 WP-Gravatar-Mini-Cache V1.0.3：</strong></p>
<p>> 小邪最近一直在考虑是否把插件升级到 v1.0.3 版，此版本是直接取代官方的 get_avatar 函数的。<br />
> 其实也就是在官方基础上增加了缓存部分，但由于函数提取自 WP 3.0.1，所以不知道各版本兼容性如何。<br />
> 先贴出来，请各位不同版本的盆友测试，有兴趣的也可以玩玩，祝大家玩得愉快，o(*￣▽￣*)ゞ。</p>
<pre class="brush: php; auto-links: false; html-script: false; title: ; notranslate">
//P.s. 其实把 &lt;? 和 ?&gt; 之间的全部代码贴到 function.php 中也行的。
&lt;?
/*
Plugin Name: WP Gravatar Mini Cache
Plugin URI: http://www.evlos.org/2010/10/18/wp-gravatar-mini-cache-v102/
Description: 迷你 Gravatar 头像缓存插件，可以将 Gravatar 头像缓存至本地，以加快加载速度，使其不受 Gravatar 服务器连接速度的影响。Wordpress mini-gravatar-cache plugin, can cache the avatars from gravatar server, and speed up the loading.
Author: Evlos
Version: 1.0.3
Author URI: http://www.evlos.org/
*/

if ( !function_exists( 'get_avatar' ) ) :
function get_avatar( $id_or_email, $size = '96', $default = '', $alt = false ) {
	if ( ! get_option('show_avatars') )
		return false;

	if ( false === $alt)
		$safe_alt = '';
	else
		$safe_alt = esc_attr( $alt );

	if ( !is_numeric($size) )
		$size = '96';

	$email = '';
	if ( is_numeric($id_or_email) ) {
		$id = (int) $id_or_email;
		$user = get_userdata($id);
		if ( $user )
			$email = $user-&gt;user_email;
	} elseif ( is_object($id_or_email) ) {
		// No avatar for pingbacks or trackbacks
		$allowed_comment_types = apply_filters( 'get_avatar_comment_types', array( 'comment' ) );
		if ( ! empty( $id_or_email-&gt;comment_type ) &amp;&amp; ! in_array( $id_or_email-&gt;comment_type, (array) $allowed_comment_types ) )
			return false;

		if ( !empty($id_or_email-&gt;user_id) ) {
			$id = (int) $id_or_email-&gt;user_id;
			$user = get_userdata($id);
			if ( $user)
				$email = $user-&gt;user_email;
		} elseif ( !empty($id_or_email-&gt;comment_author_email) ) {
			$email = $id_or_email-&gt;comment_author_email;
		}
	} else {
		$email = $id_or_email;
	}

	if ( empty($default) ) {
		$avatar_default = get_option('avatar_default');
		if ( empty($avatar_default) )
			$default = 'mystery';
		else
			$default = $avatar_default;
	}

	if ( !empty($email) )
		$email_hash = md5( strtolower( $email ) );

	if ( is_ssl() ) {
		$host = 'https://secure.gravatar.com';
	} else {
		if ( !empty($email) )
			$host = sprintf( &quot;http://%d.gravatar.com&quot;, ( hexdec( $email_hash{0} ) % 2 ) );
		else
			$host = 'http://0.gravatar.com';
	}

	if ( 'mystery' == $default )
		$default = &quot;$host/avatar/ad516503a11cd5ca435acc9bb6523536?s={$size}&quot;; // ad516503a11cd5ca435acc9bb6523536 == md5('unknown@gravatar.com')
	elseif ( 'blank' == $default )
		$default = includes_url('images/blank.gif');
	elseif ( !empty($email) &amp;&amp; 'gravatar_default' == $default )
		$default = '';
	elseif ( 'gravatar_default' == $default )
		$default = &quot;$host/avatar/s={$size}&quot;;
	elseif ( empty($email) )
		$default = &quot;$host/avatar/?d=$default&amp;amp;s={$size}&quot;;
	elseif ( strpos($default, 'http://') === 0 )
		$default = add_query_arg( 's', $size, $default );

	if ( !empty($email) ) {
		$out = &quot;$host/avatar/&quot;;
		$out .= $email_hash;
		$out .= '?s='.$size;
		$out .= '&amp;amp;d=' . urlencode( $default );

		$rating = get_option('avatar_rating');
		if ( !empty( $rating ) )
			$out .= &quot;&amp;amp;r={$rating}&quot;;

//--- WP Gravatar Mini Cache v1.0.3 --- Start ------------------------------

	$ev_time = 1209600;
	if (!is_dir(ABSPATH.'ev-iava/')) { mkdir(ABSPATH.'ev-iava/'); }
	$ev_abs = ABSPATH.'ev-iava/'.$email_hash.'_'.$size.'.jpg';
	$ev_url = get_bloginfo('wpurl').'/ev-iava/'.$email_hash.'_'.$size.'.jpg';
	if (!is_file($ev_abs)||(time()-filemtime($ev_abs))&gt;$ev_time){
		copy($out,$ev_abs);
	}
	$out = $ev_url;

//--- WP Gravatar Mini Cache v1.0.3 --- End --------------------------------

		$avatar = &quot;&lt;img alt='{$safe_alt}' src='{$out}' class='avatar avatar-{$size} photo' height='{$size}' width='{$size}' /&gt;&quot;;
	} else {

//--- WP Gravatar Mini Cache v1.0.3 --- Start ------------------------------

	$ev_abs = ABSPATH.'ev-iava/'.$size.'.jpg';
	$ev_url = get_bloginfo('wpurl').'/ev-iava/'.$size.'.jpg';
	if (!is_file($ev_abs)||(time()-filemtime($ev_abs))&gt;$ev_time){
		copy($default,$ev_abs);
	}
	$default = $ev_url;

//--- WP Gravatar Mini Cache v1.0.3 --- End --------------------------------

		$avatar = &quot;&lt;img alt='{$safe_alt}' src='{$default}' class='avatar avatar-{$size} photo avatar-default' height='{$size}' width='{$size}' /&gt;&quot;;
	}

	return apply_filters('get_avatar', $avatar, $id_or_email, $size, $default, $alt);
}
endif;
?&gt;
</pre>
<p><strong>四. 结束语：</strong></p>
<p>> 那么就这样咯，o(*￣▽￣*)ゞ。嘿嘿，喜欢折腾的童鞋请走这边 - <a target='_blank' rel='nofollow' href='http://kan.willin.org/?p=1320'>http://kan.willin.org/?p=1320</a><br />
> 跟小邪一样的懒人和不熟悉代码的盆友走这边 - <a target='_blank' rel='nofollow' href='http://wordpress.org/extend/plugins/wp-gravatar-mini-cache/'>http://wordpress.org/../wp-gravatar-mini-cache</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.rainmoe.com/2010/10/18/wp-gravatar-mini-cache-v102/feed/</wfw:commentRss>
		<slash:comments>199</slash:comments>
		</item>
		<item>
		<title>Memcached-Object-Cache内存缓存插件评测</title>
		<link>http://www.rainmoe.com/2010/08/02/memcached-object-cache/</link>
		<comments>http://www.rainmoe.com/2010/08/02/memcached-object-cache/#comments</comments>
		<pubDate>Mon, 02 Aug 2010 07:54:26 +0000</pubDate>
		<dc:creator>小邪</dc:creator>
				<category><![CDATA[cache]]></category>
		<category><![CDATA[memcache]]></category>

		<guid isPermaLink="false">http://www.evlos.org/?p=1987</guid>
		<description><![CDATA[> 这款插件可以减少一半多的查询量，Skyoy 说过，Object-Cache 系列插件都是连后台查询也会缓存的。

> 不过小邪觉得影响应该不大。顺便推荐一首歌《曾有你的森林》，小邪碰巧发现的，很不错的喔 ;D。



<span class="readmore"><a href="http://www.rainmoe.com/2010/08/02/memcached-object-cache/" title="Memcached-Object-Cache内存缓存插件评测">阅读全文——共2279字</a></span>]]></description>
			<content:encoded><![CDATA[<p>> 这款插件可以减少一半多的查询量，<a target='_blank' rel='nofollow' href='http://www.skyoy.com/'>Skyoy</a> 说过，Object-Cache 系列插件都是连后台查询也会缓存的。<br />
> 不过小邪觉得影响应该不大。顺便推荐一首歌《曾有你的森林》，小邪碰巧发现的，很不错的喔 ;D。</p>
<p><img src='http://www.rainmoe.com/wp-content/uploads/old/Cap0000715.png' /></p>
<p><span id="more-1987"></span><strong>一. 安装 Memcached：</strong></p>
<p>> 下载强力传送门 - <a target='_blank' rel='nofollow' href='http://memcached.googlecode.com/files/memcached-1.4.5.tar.gz'>http://memcached.googlecode.com/files/memcached-1.4.5.tar.gz</a></p>
<pre class="brush: php; auto-links: false; html-script: false; title: ; notranslate">
-bash-3.2# wget http://memcached.googlecode.com/files/memcached-1.4.5.tar.gz
-bash-3.2# tar xvf memcached-1.4.5.tar.gz
-bash-3.2# cd memcached-1.4.5
-bash-3.2# ./configure --prefix=/usr/local/memcached
-bash-3.2# make
-bash-3.2# make install
-bash-3.2# ./memcached -p 11211 -d -m 32m -c 1024 -u root
</pre>
<pre class="brush: php; auto-links: false; html-script: false; title: ; notranslate">
&lt;?php
$mem = new Memcache;
$mem-&gt;connect('127.0.0.1', 11211);
$mem-&gt;set('key', 'Test Successed ..', 0, 60);
$val = $mem-&gt;get('key');
echo $val;
//如果成功输出了 Test Successed ..，那就表明正在正常运行中喔
?&gt;
</pre>
<p><strong>二. 安装 Memcached-Object-Cache：</strong></p>
<p>> 这里有两个版本 2.0 和 2.0.1，2.0 适合于版本低于 WP3.0 的用户，2.0.1 则适合高版本用户。</p>
<p>> 千万不要在后台安装，只要把 object-cache.php 复制到 /wp-content 处即可 -<br />
> 2.0 稳定版下载 - <a target='_blank' rel='nofollow' href='http://downloads.wordpress.org/plugin/memcached.2.0.zip'>http://downloads.wordpress.org/plugin/memcached.2.0.zip</a><br />
> 2.0.1 开发版代码库 - <a target='_blank' rel='nofollow' href='http://plugins.trac.wordpress.org/browser/memcached/trunk/'>http://plugins.trac.wordpress.org/browser/memcached/trunk</a></p>
<p>> 也可以下载小邪打包后的程序，注意清除版本号 [_2.0.1和_2.0] 后复制到 /wp-content 处使用 -<br />
> <a target='_blank' rel='nofollow' href='http://code.google.com/p/evlosbox/downloads/detail?name=Memcached-Object-Cache_2.0-2.0.1.rar&#038;can=2&#038;q='>http://code.google.com/p/evlosbox/downloads/detail?name=Memcached-Object-Cache_2.0-2.0.1.rar</a></p>
<p><strong>三. WP 的 Memcached 优化效果：</strong></p>
<pre class="brush: php; auto-links: false; html-script: false; title: ; notranslate">
&lt;!–- Info : 9 queries in 0.156 seconds –&gt;　　&lt;!–- Info : 2 queries in 0.151 seconds –&gt;
&lt;!–- Info : 9 queries in 0.153 seconds –&gt;　　&lt;!–- Info : 2 queries in 0.149 seconds –&gt;
&lt;!–- Info : 9 queries in 0.151 seconds –&gt;　　&lt;!–- Info : 2 queries in 0.149 seconds –&gt;
&lt;!–- Info : 9 queries in 0.159 seconds –&gt;　　&lt;!–- Info : 2 queries in 0.154 seconds –&gt;
&lt;!–- Info : 9 queries in 0.156 seconds –&gt;　　&lt;!–- Info : 2 queries in 0.152 seconds –&gt;
//上面是首页的运行信息，下面则是文章页面的

&lt;!–- Info : 17 queries in 0.502 seconds –&gt;　　&lt;!–- Info : 6 queries in 0.520 seconds –&gt;
&lt;!–- Info : 17 queries in 0.512 seconds –&gt;　　&lt;!–- Info : 6 queries in 0.529 seconds –&gt;
&lt;!–- Info : 17 queries in 0.508 seconds –&gt;　　&lt;!–- Info : 6 queries in 0.540 seconds –&gt;
&lt;!–- Info : 17 queries in 0.515 seconds –&gt;　　&lt;!–- Info : 6 queries in 0.538 seconds –&gt;
&lt;!–- Info : 17 queries in 0.510 seconds –&gt;　　&lt;!–- Info : 6 queries in 0.518 seconds –&gt;
//呵呵，优化效果还是可以接受的，查询次数少了一半多，数据库大大减负了
//至于查询时间没有减少的原因，基本上是因为磁盘 I/O 的限制或者服务器性能的问题
//负载能力当然是有所提高的，就是说原先一个人要查询 17 次，现在 3 个人加起来才有那么多
</pre>
<p><strong>四. Memcache 与 Memcached 的区别：</strong></p>
<p>> 通常来说，Memcache 是一个自由和开放源代码的、高性能的、可分配的内存对象缓存系统。<br />
> 用于加速动态web应用程序，减轻数据库负载。有很多强力的网站都在用 Memcache -<br />
> LiveJournal、Wikipedia、Flickr、Bebo、Twitter、Typepad、Yellowbot、Youtube 等等。</p>
<p>> Memcache 是该系统的项目名称，Memcached 是该系统的主程序文件，以守护程序方式运行。<br />
> 可以运行于一个或多个服务器中，随时接受客户端的连接操作，使用共享内存存取数据。</p>
<pre class="brush: php; auto-links: false; html-script: false; title: ; notranslate">
已编译模块检测：
date  libxml  openssl  pcre  zlib  bcmath  ctype  curl  dom  filter  ftp  gd
gettext  hash  iconv  json  mbstring  mcrypt  mhash  mime_magic  mysql  SimpleXML
pcntl  SPL  PDO  pdo_sqlite  posix  Reflection  session  shmop  mysqli  soap  sockets
SQLite  standard  sysvsem  tokenizer  xml  xmlreader  xmlrpc  xmlwriter  zip  cgi-fcgi
memcache  pdo_mysql  Zend Optimizer  eAccelerator
</pre>
<p>> PHP 中的所讲的 Memcache 是用于连接 Memecached 的客户端组件。<br />
> 即你能够在 PHP 探针里面看到的已编译模块列表里面的那个，这只是说明 PHP 可以使用 Memcache。<br />
> 并不能说明你的服务器已经安装了这个内存缓存程序，一般我们用上方的那个程序检测安装情况。</p>
<p><strong>五. 尾记：</strong></p>
<p>> 前面在写一个把用户评论处时间变为 “XXX在1小时20分钟之前说” “XXX在18秒之前说” 的样式的函数。<br />
> 虽然网上有很多差不多的，不过感觉不大适合小邪，o(*￣▽￣*)o，所以就自己动手，丰衣足食鸟。<br />
> 这个东西回头再发布，现在本地测试中 ╮(￣▽￣)╭。</p>
<p><embed src="http://www.xiami.com/widget/134548_1768967720/singlePlayer.swf" type="application/x-shockwave-flash" width="257" height="33" wmode="transparent"></embed></p>
<p>> 推荐一首歌《曾有你的森林》，很有感觉的说，也是《我叫MT》插曲《意外之外》的原曲，还有首MV。<br />
> 深邃的MV的传送门 - <a target='_blank' rel='nofollow' href='http://v.youku.com/v_show/id_XMTkzOTYxNzc2.html'>http://v.youku.com/v_show/id_XMTkzOTYxNzc2.html</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.rainmoe.com/2010/08/02/memcached-object-cache/feed/</wfw:commentRss>
		<slash:comments>86</slash:comments>
		</item>
		<item>
		<title>各种需服务器支持的WP缓存插件的调查报告</title>
		<link>http://www.rainmoe.com/2010/07/31/wordpress-cache-plugins-with-special-server-support/</link>
		<comments>http://www.rainmoe.com/2010/07/31/wordpress-cache-plugins-with-special-server-support/#comments</comments>
		<pubDate>Sat, 31 Jul 2010 09:19:17 +0000</pubDate>
		<dc:creator>小邪</dc:creator>
				<category><![CDATA[探索 [Explore]]]></category>
		<category><![CDATA[cache]]></category>
		<category><![CDATA[research]]></category>

		<guid isPermaLink="false">http://www.evlos.org/?p=1985</guid>
		<description><![CDATA[> 此文列举了目前流行的 5 种需服务器支持的缓存方式，结合 WordPress 进行依次淘汰，得出最终结论。

> 有描述详细的选择过程和原因，但还没来得及对最后选择的一款插件进行测试，评测文章下次发布咯。



<span class="readmore"><a href="http://www.rainmoe.com/2010/07/31/wordpress-cache-plugins-with-special-server-support/" title="各种需服务器支持的WP缓存插件的调查报告">阅读全文——共2928字</a></span>]]></description>
			<content:encoded><![CDATA[<p>> 此文列举了目前流行的 5 种需服务器支持的缓存方式，结合 WordPress 进行依次淘汰，得出最终结论。<br />
> 有描述详细的选择过程和原因，但还没来得及对最后选择的一款插件进行测试，评测文章下次发布咯。</p>
<p><img src='http://www.rainmoe.com/wp-content/uploads/old/Cap0000676.png' /></p>
<p><span id="more-1985"></span><strong>一. 首先排除 WinCache 缓存方式：</strong></p>
<p>> 目前需要服务器特殊支持的缓存程序大概有以下几种 -<br />
> Alternative PHP Cache（APC）、XCache、eAccelerator、Memcached、WinCache。</p>
<p><img src='http://www.rainmoe.com/wp-content/uploads/old/Cap0000673.png' /></p>
<p>> 我们首先排除掉 Wincache，因为它只支持 Windows 服务器，这年头 Win 服务器用着蛋疼 ╮(￣▽￣")╭。</p>
<p><strong>二. 初步确定 6 款插件：</strong></p>
<p>1. XCache<br />
> 关于这个缓存程序，小邪找到了 XCache for WordPress 0.6 和 W3 Total Cache。</p>
<p>2. APC<br />
> 然后关于这个缓存程序，小邪又找到了 APC Cache 和 W3 Total Cache。</p>
<p>3. eAccelerator<br />
> 接着查找支持这个缓存的插件，发现鸟 eAccelerator for WordPress 0.6 和 W3 Total Cache。<br />
> ╮(￣▽￣")╭，还有一个是 WP-Super-Cache Plus，这个是 WP-Super-Cache 的加强版。</p>
<p>4. Memcached<br />
> 最后在支持 Memcached 的程序的相关结果上，找到 Memcached Backend 和 W3 Total Cache。</p>
<p><strong>三. 舍弃支持五种缓存机制的 W3 Total Cache 插件：</strong></p>
<p>> hoho，W3 Total Cache 插件是目前数一数二的强大缓存程序，作者提供对以上四种方案的全部支持。<br />
> 但它只有在 VPS 和独立服务器上才能充分发挥强大的缓存能力，因为多数虚拟主机并不支持以上功能。<br />
> P.s. 还有一种缓存机制是文件缓存，这里我们就不研究了，因为不需要服务器支持。</p>
<p><img src='http://www.rainmoe.com/wp-content/uploads/old/Cap0000675.png' /></p>
<p>> 下载传送门 - <a target='_blank' rel='nofollow' href='http://wordpress.org/extend/plugins/w3-total-cache/'>http://wordpress.org/extend/plugins/w3-total-cache</a></p>
<p>> 但是这个插件有一个缺陷，就是不支持 Nginx。<br />
> 虽然 Apache 的 rewrite 代码有办法转为 Nginx 的代码，但这个插件的 rewrite 实在是太复杂鸟。<br />
> 所以如果你的 VPS 是用 Apache 服务器的，那么可以尽情使用这个插件咯，小邪就不得不舍弃它了。</p>
<p><strong>四. 排除掉 WP-Super-Cache Plus 插件：</strong></p>
<p>> 原因是这款插件的升级速度过于缓慢了，其实这个不能怪增强版的作者，因为作者在工作上太忙了。<br />
> 项目页 - <a target='_blank' rel='nofollow' href='http://wpscp.trac.armadillo.homeip.net/wiki#Downloads'>http://wpscp.trac.armadillo.homeip.net/wiki#Downloads</a></p>
<pre class="brush: php; auto-links: false; html-script: false; title: ; notranslate">
Latest Stable Version -- 0.7.5.5 -- 2009-07-22
//这款增强版才 0.7.5.5

Current Version -- 0.9.9.3
//而原版已经到 0.9.9.3 鸟
</pre>
<p><strong>五. 还剩 4 款插件：</strong></p>
<p>> XCache for WordPress 0.6 -- 最后更新时间 2007年10月28日，已知仅兼容到 WP 2.X.X<br />
> eAccelerator for WordPress 0.6 -- 最后更新时间 2007年10月28日，已知仅兼容到 WP 2.X.X，同上<br />
> APC Cache 0.2 -- 作者网站的插件文章页面已经不存在，没有安装说明，兼容性未知，更新时间未知<br />
> Memcached Backend 2.0.1 -- 支持 WordPress3.0</p>
<p><strong>六. 抉择到最后 Memcached Backend 2.0.1：</strong></p>
<pre class="brush: php; auto-links: false; html-script: false; title: ; notranslate">
=== Memcached Object Cache ===
Requires at least: 3.0
Stable tag: 2.0

== Description ==
Memcached Object Cache provides a persistent backend for the WordPress object cache. A memcached server and the PECL memcache extension are required.

== Installation ==
1. Install [memcached](http://danga.com/memcached) on at least one server.
  Note the connection info. The default is `127.0.0.1:11211`.

1. Install the [PECL memcache extension](http://pecl.php.net/package/memcache)

1. Copy object-cache.php to wp-content
</pre>
<p>> Trunk 页面 - <a target='_blank' rel='nofollow' href='http://plugins.trac.wordpress.org/browser/memcached/trunk'>http://plugins.trac.wordpress.org/browser/memcached/trunk</a></p>
<p><strong>七. 附加信息：</strong></p>
<pre class="brush: php; auto-links: false; html-script: false; title: ; notranslate">
/*
Eaccelerator (以下简称为eacc)，是一个开源的opcode 缓存器/优化器，诞生于2004 年
12 月。它是Turck MMCache 项目的延伸，可以对整个页面，或者一段执行代码，甚至只是
一个变量进行缓存。目前支持PHP4.X，PHP5.X，兼容Zend Optimizer，不支持分布式的内
容缓存。

XCache，由lighttpd 的核心开发成员mOo 领队开发，也是一个开源的opcode 缓存器和
优化器，其主要特点是团队开发非常活跃，更新速度很快，能及时地跟进PHP 的最新发布
版本，目前支持PHP6，兼容Zend Optimizer，不支持分布式的内容缓存。

Memcached 是Danga Interactive 为加快LiveJournal.com 的访问速度而开发的高性能、支
持分布式内存对象缓存的系统，分为服务端和客户端。其服务端在指定的IP 地址和tcp 端
口监听，对客户端提交的读写缓存对象的请求进行响应。他提供的客户端API 主要支持Perl，
PHP，Python，Ruby，Java，C#，C，Postgres，并提供编程接口方便开发出其它语言的客户
端API。兼容Zend Optimizer。由于memcached 作为一个独立的进程运行中服务端，完全使
用内存进行缓存，并且可以进行分布式的部署，即可以同时部署多台memcached 服务器作
为内存缓冲来使用，是目前很多大型网站部署缓存系统的首选。

APC，即Alternative PHP Cache，是作为PHP PECL 发布的opcode 缓存器和优化器，但
是目前不兼容ZendOptimizer。支持脚本的预编译缓存，也支持变量缓存。
*/
</pre>
<p><strong>八. 尾记：</strong></p>
<p>> 先写到这里，嘎嘎，接着小邪要在 VPS 上面安装 Memcached，然后开始测试，结果将发在新文章上。<br />
> 希望这篇文章能让大家对这些缓存器和优化器有一定的了解，说不定会有什么意外的收获喔 o(*≧▽≦)ツ。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rainmoe.com/2010/07/31/wordpress-cache-plugins-with-special-server-support/feed/</wfw:commentRss>
		<slash:comments>75</slash:comments>
		</item>
		<item>
		<title>如何使WP-Super-Cache支持Nginx</title>
		<link>http://www.rainmoe.com/2010/07/12/wp-super-cache-and-nginx/</link>
		<comments>http://www.rainmoe.com/2010/07/12/wp-super-cache-and-nginx/#comments</comments>
		<pubDate>Sun, 11 Jul 2010 23:27:17 +0000</pubDate>
		<dc:creator>小邪</dc:creator>
				<category><![CDATA[代码 [Code]]]></category>
		<category><![CDATA[cache]]></category>
		<category><![CDATA[nginx]]></category>

		<guid isPermaLink="false">http://www.evlos.org/?p=1960</guid>
		<description><![CDATA[> 嘎嘎，小邪是标准的缓存控，啥都想要缓存一下以加快速度，所以这次要把 Super-Cache 搞定。

> 如果用的 Apache，是不需要那么麻烦的。不过如果用的是 Nginx，那么，来，开始强力折腾。



<span class="readmore"><a href="http://www.rainmoe.com/2010/07/12/wp-super-cache-and-nginx/" title="如何使WP-Super-Cache支持Nginx">阅读全文——共3726字</a></span>]]></description>
			<content:encoded><![CDATA[<p>> 嘎嘎，小邪是标准的缓存控，啥都想要缓存一下以加快速度，所以这次要把 Super-Cache 搞定。<br />
> 如果用的 Apache，是不需要那么麻烦的。不过如果用的是 Nginx，那么，来，开始强力折腾。</p>
<p><img src='http://www.rainmoe.com/wp-content/uploads/old/Cap0000441.png' /></p>
<p><span id="more-1960"></span><strong>一. 使WP-Super-Cache支持Nginx：</strong></p>
<p>> 首先登陆 SSH，进入 Nginx 的配置文件，然后创建一个新文件，保存为 WordPress_001.conf。</p>
<pre class="brush: jscript; auto-links: false; html-script: false; title: ; notranslate">
-bash-3.2# cd /usr/local/nginx/conf
-bash-3.2# vi wordpress_001.conf
</pre>
<p>> 然后将下面内容贴入编辑器。以下代码由插件作者博客处获取，有兴趣请过此传送门传送查看。<br />
> 传送门 - <a target='_blank' rel='nofollow' href='http://ocaoimh.ie/wordpress-nginx-wp-super-cache/'>http://ocaoimh.ie/wordpress-nginx-wp-super-cache/</a></p>
<pre class="brush: php; auto-links: false; html-script: false; title: ; notranslate">
location / {
# if the requested file exists, return it immediately
               if (-f $request_filename) {
                       break;
               }
               set $supercache_file '';
               set $supercache_uri $request_uri;
               if ($request_method = POST) {
                       set $supercache_uri '';
               }
# Using pretty permalinks, so bypass the cache for any query string
               if ($query_string) {
                       set $supercache_uri '';
               }
               if ($http_cookie ~* &quot;comment_author_|wordpress|wp-postpass_&quot; ) {
                       set $supercache_uri '';
               }
# if we haven't bypassed the cache, specify our supercache file
               if ($supercache_uri ~ ^(.+)$) {
                       set $supercache_file /wp-content/cache/supercache/$http_host/$1index.html;
               }
# only rewrite to the supercache file if it actually exists
               if (-f $document_root$supercache_file) {
                       rewrite ^(.*)$ $supercache_file break;
               }
# all other requests go to WordPress
               if (!-e $request_filename) {
                       rewrite . /index.php last;
               }
}
</pre>
<pre class="brush: jscript; auto-links: false; html-script: false; title: ; notranslate">
:wq //接着保存退出编辑器 P.s. 双斜杠及后续内容表示注释
-bash-3.2# cd ../ //这个命令是返回上层目录
-bash-3.2# ls //列出目录文件
dabr.conf               koi-utf             other.conf
discuz.conf             koi-win             sablog.conf
fastcgi.conf            mime.types          typecho.conf
fastcgi.conf.default    mime.types.default  vhost
fastcgi_params          n.conf              win-utf
fastcgi_params.default  nginx.conf          wordpress.conf
fcgi.conf               nginx.conf.default  wordpress_evlos.conf
imsurl.conf             none.conf
-bash-3.2# vi nginx.conf //如果直接建立在主机上，就编辑这个配置文件
-bash-3.2# cd vhost //否则就请进入虚拟主机配置文件目录
-bash-3.2# vi evlos.org.conf //编辑当前虚拟主机配置文件
</pre>
<pre class="brush: jscript; auto-links: false; html-script: false; title: ; notranslate">
root  /home/host/evlos.org;
//一般找到上面这行配置
include wordpress_001.conf;
//然后添加下面这行来载入刚才的 WordPress_001.conf，如果已经存在则修改
</pre>
<pre class="brush: jscript; auto-links: false; html-script: false; title: ; notranslate">
-bash-3.2# ./lnmp restart
//如果是 Lnmp，那么重启一下就OK鸟，嘿嘿嘿
</pre>
<p><strong>二. 关于插件的配置：</strong></p>
<p>> 首先启用 WP-Super-Cache 插件，如果要设置手机访问缓存，请选择 Mobile device support。</p>
<p><img src='http://www.rainmoe.com/wp-content/uploads/old/Cap0000447.png' /></p>
<p>> 缓存时间设置为 864000 秒，因为发表文章和评论时会自动更新，所以小邪觉得这样蛮合理的。</p>
<p><img src='http://www.rainmoe.com/wp-content/uploads/old/Cap0000450.png' /></p>
<p><strong>三. Preload Cache：</strong></p>
<p>> 因为这个插件的汉化包不是最新的，所以请大家挺住，这里英文小邪会简单讲解一下，要蛋定。</p>
<p><img src='http://www.rainmoe.com/wp-content/uploads/old/Cap0000448.png' /></p>
<p>> 下面小邪会简单翻译一下，并按照自己的理解补充进行一下说明，呵呵，不好的地方请见谅哈。</p>
<pre class="brush: jscript; auto-links: false; html-script: false; title: ; notranslate">
This will cache every published post and page on your site. It will create supercache static files so unknown visitors (including bots) will hit a cached page. This will probably help your Google ranking as they are using speed as a metric when judging websites now.

//简单说，一般缓存文件都是在用户访问这个页面时候才产生的，也就是说如果清理过缓存，那么所有的页面只有在被访问的时候才会产生缓存。如果是 Google 对网站进行排名的时候，（因为目前 Google 也将网站的访问速度作为一个重要的评价因素 By 小邪），所以会对这个评价有不利的影响，（汗，应该也就是小邪的评价一直很低的原因）。

Preloading creates lots of files however. Caching is done from the newest post to the oldest so please consider only caching the newest if you have lots (10,000+) of posts. This is especially important on shared hosting.

//预加载的作用是提前将博客里面所有的页面都提前一次性批量生成缓存，但是请注意在生成的时候会占用一定的资源，如果是合租VPS之类的，（请在访问量小的时候进行 by 小邪）。

In ’Preload Mode’ regular garbage collection will only clean out old half-on files for known users, not the preloaded supercache files. This is a recommended setting when the cache is preloaded.

//缓存文件操作与 WP-super-cache 半开启状态的文件无关

Refresh preloaded cache files every  minutes. (0 to disable, minimum 30 minutes.)

//缓存文件刷新时间，小邪觉得这里填半个月都木有关系，21600 min 为半个月

Preload mode (garbage collection only on half-on cache files. Recommended.)
//开启预加载模式

Send me status emails when files are refreshed.
//预加载邮件报告功能开关

     Many emails, 2 emails per 100 posts.
     Medium, 1 email per 100 posts.
     Less emails, 1 at the start and 1 at the end of preloading all posts.
</pre>
<p><strong>三. 关于菠萝阁回复邮件通知被认为垃圾邮件：</strong></p>
<p>> 额，杯具了这个，小邪的回复邮件通知不知道被谁举报为垃圾邮件，所以 Gmail 进行了过滤。</p>
<p>> 目前的解决办法 -<br />
> 1. 请点击 Gmail 邮件窗口顶部的 “创建过滤器”<br />
> 2. 发件人处请填入 lost578@gmail.com 并点击下一步<br />
> 3. 将 “不要将其发送至“垃圾邮件”” 勾选并点击更新过滤器即可</p>
<p>> 好大的一个茶几啊啊 ~ ~ (～o￣▽￣)～o ~，回头看看发封邮件给谷歌有木有用，春哥保佑 >.<。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rainmoe.com/2010/07/12/wp-super-cache-and-nginx/feed/</wfw:commentRss>
		<slash:comments>58</slash:comments>
		</item>
		<item>
		<title>如何为Dabr增加用户头像缓存功能</title>
		<link>http://www.rainmoe.com/2010/04/29/add-avatar-cache-to-dabr/</link>
		<comments>http://www.rainmoe.com/2010/04/29/add-avatar-cache-to-dabr/#comments</comments>
		<pubDate>Wed, 28 Apr 2010 19:05:57 +0000</pubDate>
		<dc:creator>小邪</dc:creator>
				<category><![CDATA[代码 [Code]]]></category>
		<category><![CDATA[avatar]]></category>
		<category><![CDATA[cache]]></category>
		<category><![CDATA[dabr]]></category>

		<guid isPermaLink="false">http://www.evlos.org/?p=1939</guid>
		<description><![CDATA[> 嘿嘿，折腾就是一种乐趣呐。小邪需要充满创意的生活，所以总是无尽地折腾着呐，O(∩_∩)O。

> 这篇文章的配图有点儿老了，呵呵。因为小邪总是有点子就新建草稿，所以发布就迟了一些呐。



<span class="readmore"><a href="http://www.rainmoe.com/2010/04/29/add-avatar-cache-to-dabr/" title="如何为Dabr增加用户头像缓存功能">阅读全文——共1015字</a></span>]]></description>
			<content:encoded><![CDATA[<p>> 嘿嘿，折腾就是一种乐趣呐。小邪需要充满创意的生活，所以总是无尽地折腾着呐，O(∩_∩)O。<br />
> 这篇文章的配图有点儿老了，呵呵。因为小邪总是有点子就新建草稿，所以发布就迟了一些呐。</p>
<p><img src='http://www.rainmoe.com/wp-content/uploads/old/Cap0000267.png' /></p>
<p><span id="more-1939"></span>> 这篇文章给 Dabr 增加了用户头像缓存功能，毕竟这个头像服务器也蛮脆弱的，有延迟很不爽。<br />
> 其实代码还是老代码，是给 WP 增加头像缓存的代码来着。不过很多老的东西还是很实用，嘻。</p>
<p><strong>一. Dabr 用户头像缓存功能：</strong></p>
<p>> 直接修改 Dabr 程序中的这个文件即可 - /common/twitter.php，首先我们找到下面这个函数。</p>
<pre class="brush: php; auto-links: false; html-script: false; title: ; notranslate">
function theme_avatar($url, $force_large = false) {
  $size = $force_large ? 48 : 24;
  return &quot;&lt;img src='$url' height='$size' width='$size' /&gt;&quot;;
}
</pre>
<p>> 然后修改成下面这样子即可，程序会自动创建 /ava/ 文件夹来存放头像缓存文件，O(∩_∩)O。</p>
<pre class="brush: php; auto-links: false; html-script: false; title: ; notranslate">
function theme_avatar($url, $force_large = false) {
  $size = $force_large ? 48 : 24;
  $dir = './ava/';
  if (!is_dir($dir)) { mkdir($dir); }
  $time = 1209600;
  preg_match('/[^\/]*$/i',$url,$name);
  $local = $dir.$name[0];
  if (!is_file($local)||(time()-filemtime($local))&gt;$time){
    copy($url,$local);
  }
  return &quot;&lt;img src='$local' height='$size' width='$size' /&gt;&quot;;
}
</pre>
<p><strong>二. 生活手记：</strong></p>
<p>> 最近荷兰的天气突然开始升温了，速度升的好快，大家都变成了穿短袖的样子，太阳也出来了。<br />
> （- -||)，其实从初到荷兰到现在，还木有看见过多少次的太阳，最近天天看着反而不习惯了。</p>
<p><img src='http://www.rainmoe.com/wp-content/uploads/old/IMAG0160.jpg' /></p>
<p>> 第一张照片是初到荷兰的样子，一直天气阴云密布的，不过小邪也很喜欢下雨天的呐，嘿嘿。</p>
<p><img src='http://www.rainmoe.com/wp-content/uploads/old/IMAG0123.jpg' /></p>
<p><img src='http://www.rainmoe.com/wp-content/uploads/old/IMAG0122.jpg' /></p>
<p>> 上面两张则是最近几天在公园里面照的，这里公园的景色真不赖，呵呵，尾气排放也很干净。<br />
> 嘿嘿，就这样，文章不应该写得很长长长长长长长长长长，所以就这样结尾了喔，O(∩_∩)P。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rainmoe.com/2010/04/29/add-avatar-cache-to-dabr/feed/</wfw:commentRss>
		<slash:comments>62</slash:comments>
		</item>
		<item>
		<title>WP插件Gravatar-Mini-Cache</title>
		<link>http://www.rainmoe.com/2010/01/25/my-first-plugin-mini_gravatar_cache/</link>
		<comments>http://www.rainmoe.com/2010/01/25/my-first-plugin-mini_gravatar_cache/#comments</comments>
		<pubDate>Mon, 25 Jan 2010 05:40:57 +0000</pubDate>
		<dc:creator>小邪</dc:creator>
				<category><![CDATA[作品 [Work]]]></category>
		<category><![CDATA[cache]]></category>
		<category><![CDATA[gravatar]]></category>
		<category><![CDATA[plugins]]></category>

		<guid isPermaLink="false">http://www.evlos.org/?p=1908</guid>
		<description><![CDATA[> 小邪发现其实插件并不是那么难写，只要搞清楚 WP 的 Hook 功能就可以很能搞出一个插件，很简单喔。

> 那个，说真的，小邪以前其实对自己不懂又貌似很复杂的东东总觉得怕怕的，但一咬牙就很快学会鸟。



<span class="readmore"><a href="http://www.rainmoe.com/2010/01/25/my-first-plugin-mini_gravatar_cache/" title="WP插件Gravatar-Mini-Cache">阅读全文——共534字</a></span>]]></description>
			<content:encoded><![CDATA[<p>> 小邪发现其实插件并不是那么难写，只要搞清楚 WP 的 Hook 功能就可以很能搞出一个插件，很简单喔。<br />
> 那个，说真的，小邪以前其实对自己不懂又貌似很复杂的东东总觉得怕怕的，但一咬牙就很快学会鸟。</p>
<p><img src='http://www.rainmoe.com/wp-content/uploads/old/Cap0000010.jpg' /></p>
<p><span id="more-1908"></span><strong>一. 简单安装 Install：</strong></p>
<p>> 通用老方法，先解压缩，然后把 Mini-gravatar-cache 目录放到 WordPress 中 Wp-content 的 Plugins 里。<br />
> 接着再进入 WP 的后台插件管理，找到 Mini Gravatar Cache 这个插件，最后启用这个插件就 OK 咯。</p>
<p><img src="http://www.rainmoe.com/wp-content/uploads/2010/01/Cap0001917.png" alt="" title="" width="600" height="440" class="alignnone size-full wp-image-2087" /></p>
<p><strong>二. 关于 WP-Gravatar-Mini-Cache v1.00：</strong></p>
<p>> 由于 <a target='_blank' rel='nofollow' href='http://kan.willin.org/'>willin大湿</a> 更新了他原本的代码，并且修改成了 Hook 形式，而小邪则是另辟蹊径，达到类似的效果。<br />
> 所以小邪的这个插件应该算是分支衍生版本吧。呵呵，用得开心就好，喜欢折腾就用Willin，懒人用小邪。</p>
<p>> WordPress官网下载传送门 - <a target='_blank' rel='nofollow' href='http://wordpress.org/extend/plugins/wp-gravatar-mini-cache/'>http://wordpress.org/extend/plugins/wp-gravatar-mini-cache/</a></p>
<p><strong>三. Update：</strong></p>
<p>> 老页面存档 - <a target='_blank' rel='nofollow' href='http://www.evlos.org/2009/01/04/original_my-first-plugin-mini_gravatar_cache/'>http://www.evlos.org/2009/01/04/original_my-first-plugin-mini_gravatar_cache/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.rainmoe.com/2010/01/25/my-first-plugin-mini_gravatar_cache/feed/</wfw:commentRss>
		<slash:comments>233</slash:comments>
		</item>
		<item>
		<title>Willin迷你Gravatar缓存修改版</title>
		<link>http://www.rainmoe.com/2010/01/20/modified-version-of-mini-gravatar-caching-program/</link>
		<comments>http://www.rainmoe.com/2010/01/20/modified-version-of-mini-gravatar-caching-program/#comments</comments>
		<pubDate>Wed, 20 Jan 2010 11:49:11 +0000</pubDate>
		<dc:creator>小邪</dc:creator>
				<category><![CDATA[作品 [Work]]]></category>
		<category><![CDATA[cache]]></category>
		<category><![CDATA[gravatar]]></category>

		<guid isPermaLink="false">http://www.evlos.org/?p=1881</guid>
		<description><![CDATA[> 最近老拿万戈老兄的文章来做题材，小邪都脸红鸟，╮(╯▽╰)╭，正在灰常用力地寻找灵感中。

> 万戈兄写了《WordPress gravatar 头像缓存补充说明》，小邪立马就换上了迷你缓存。



<span class="readmore"><a href="http://www.rainmoe.com/2010/01/20/modified-version-of-mini-gravatar-caching-program/" title="Willin迷你Gravatar缓存修改版">阅读全文——共450字</a></span>]]></description>
			<content:encoded><![CDATA[<p>> 最近老拿万戈老兄的文章来做题材，小邪都脸红鸟，╮(╯▽╰)╭，正在灰常用力地寻找灵感中。<br />
> 万戈兄写了《<a target='_blank' rel='nofollow' href='http://wange.im/gravatar-buffer-supplement-in-wordpress.html'>WordPress gravatar 头像缓存补充说明</a>》，小邪立马就换上了迷你缓存。</p>
<p><img src='http://www.rainmoe.com/wp-content/uploads/old/Capture1159.jpg' /></p>
<p>> 但是因为小邪分别有多个地方都要用到显示头像，所以小邪把程序的主要代码隔离了出来。<br />
> 以减少空间占用。同时文中还有怎样编写回调函数的简单介绍，以此送给小邪的盆友 <a target='_blank' rel='nofollow' href='http://fatkun.com'>Fatkun</a>。</p>
<p><span id="more-1881"></span><strong>一. 使用方法：</strong></p>
<p>> 呵呵，这里需要一个邮箱地址作为参数即可，/iava/iava.php?co=4tyle8@gmail.com。<br />
> 像上面那行一样子填写就好咯，那么具体的在 WP 中的代码如下，小邪多举一些例子。</p>
<p><strong>1. 评论模板处头像：</strong></p>
<p>> 额，因为小邪的模板代码有点儿旧，没有使用 Wp_list_comments 函数，所以不需回调。<br />
> 如果在模板的 Comments.php 中发现了 Wp_list_comments 函数，请参考<a target='_blank' rel='nofollow' href='http://wange.im/diy-wordpress-comment-style.html'>万戈兄的文章</a>。</p>
<pre class="brush: php; auto-links: false; html-script: false; title: ; notranslate">
&lt;img src=&quot;/iava/iava.php?co=&lt;?php echo ($comment-&gt;comment_author_email);
?&gt;&quot; height=&quot;32&quot; width=&quot;32&quot; /&gt;
</pre>
<p><strong>2. WP-RecentComments 插件侧栏：</strong></p>
<p>> 修改处位于 wp-recentcomments/core.php，请按照下面的样子填入正确位置。</p>
<pre class="brush: php; auto-links: false; html-script: false; title: ; notranslate">
// 当默认头像来自 &quot;/wp-recentcomments/avatars/&quot; 目录时
} else if ($default != '') {
	$file = 'wp-content/plugins/wp-recentcomments/avatars/' . $default;
	if (file_exists($file)) {
		$file = get_bloginfo('siteurl') . '/' . $file;
		$avatar = '&lt;div class=&quot;rc_avatar rc_' . $position . '&quot;&gt;' .
get_avatar($email, $size, $file) . '&lt;/div&gt;';
	}
// 当不包含默认头像时
} else {
	$avatar = '&lt;div class=&quot;rc_avatar rc_' . $position . '&quot;&gt;&lt;img
src=&quot;http://tool.evlos.org/iava/iava.php?co='. md5(strtolower($email))
.'&quot; alt=&quot;&quot; /&gt;&lt;/div&gt;';
}
</pre>
<p><strong>3. WP-Thread-Comment 插件嵌套：</strong></p>
<p>> 修改处位于此插件后台控制面板中的 “编辑评论的HTML” 处，请按需要填入正确位置。</p>
<pre class="brush: php; auto-links: false; html-script: false; title: ; notranslate">
&lt;img src=&quot;/iava/iava.php?co=&lt;?php echo ($comment-&gt;comment_author_email);
?&gt;&quot; height=&quot;24&quot; width=&quot;24&quot; /&gt;
</pre>
<p>> 万戈兄原文传送门 - <a target='_blank' rel='nofollow' href='http://wange.im/gravatar-buffer-supplement-in-wordpress.html'>http://wange.im/gravatar-buffer-supplement-in-wordpress.html</a></p>
<p><strong>二. Willin迷你Gravatar缓存小邪修改版：</strong></p>
<p><img src='http://www.rainmoe.com/wp-content/uploads/old/Capture1160.jpg' /></p>
<pre class="brush: php; auto-links: false; html-script: false; title: ; notranslate">
&lt;?php
if (isset($_GET['co'])) {
	$ava_mail_md5 = $_GET['co'];
	$ava_mail_md5 = md5(strtolower($ava_mail_md5));
	$ava_url = './imgs/'.$ava_mail_md5.'.jpg';
	$ava_save_time = 1209600;
	$ava_default = 'http://'.$_SERVER[&quot;HTTP_HOST&quot;].
dirname($_SERVER['SCRIPT_NAME']).'/default.jpg';
	if (!is_file($ava_url)||(time()-filemtime($ava_url))&gt;$ava_save_time){
		$ava_get_url = 'http://www.gravatar.com/avatar/'.$ava_mail_md5.'?
s=32&amp;d='.$ava_default.'&amp;r=G';
		copy($ava_get_url,$ava_url);
	}
	if (filesize($ava_url)&lt;500) {
		copy($ava_default, $ava_url);
	}
	header('location: '.$ava_url);
}
?&gt;
</pre>
<p>> Willin原版程序传送门 - <a target='_blank' rel='nofollow' href='http://willin.heliohost.org/?p=1277'>http://willin.heliohost.org/?p=1277</a></p>
<p><strong>三. Header 函数的特殊用法：</strong></p>
<p>> 小邪之所以把这个用法放在一个独立的标题下面讲，是因为小邪发现这样用特爽。<br />
> 比如有一张图片的地址是 http://www.evlos.org/1.jpg，那么我们就这样。</p>
<pre class="brush: php; auto-links: false; html-script: false; title: ; notranslate">
&lt;?php header('location: http://www.evlos.org/1.jpg'); ?&gt;
</pre>
<p>> 把这段代码保存为一个 PHP 文件，比如 http://www.evlos.org/2.php。<br />
> 然后我们这样子用，浏览器显示的确是上面 1.jpg 的样子，感觉特爽。</p>
<pre class="brush: php; auto-links: false; html-script: false; title: ; notranslate">
&lt;img src=&quot;http://www.evlos.org/2.php&quot; /&gt;
</pre>
<p>> 这样子可是妙用无穷喔，小邪就不多举例子鸟，(*^__^*) 嘻嘻，祝玩得开心。</p>
<p><strong>四. 如何编写回调函数：</strong></p>
<p>> Fatkun 问了小邪如何编写回调函数的问题，那么这些内容就送给 Fatkun 咯。<br />
> 大家有兴趣的就一起看喔，打酱油的盆友，就帮小邪研究一下下面图片是否清晰吧。</p>
<p><img src='http://www.rainmoe.com/wp-content/uploads/old/Capture1158.png' /></p>
<p>> 小邪举一个最简单的例子，想必大家一定都能理解回调函数如何编写了喔。</p>
<pre class="brush: php; auto-links: false; html-script: false; title: ; notranslate">
$func_cont = 'echo $a+$b+$c;';
$func_val = '$a,$b,$c';
$func = create_function($func_val,$func_cont);
$func(1,2,3);
</pre>
<p>> 变量 $func_val 里面存储的是函数的变量，而 $func_cont 存储的则是函数内容。<br />
> 咱们使用 Create_function 来建立这个函数，然后就可以使用咯，不难的喔。</p>
<p>> 吼吼，小邪去看《24小时》第三、四两集咯，看完再到博友博客上转悠转悠 O(∩_∩)O。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rainmoe.com/2010/01/20/modified-version-of-mini-gravatar-caching-program/feed/</wfw:commentRss>
		<slash:comments>125</slash:comments>
		</item>
		<item>
		<title>使用本地DNS缓存加速上网</title>
		<link>http://www.rainmoe.com/2009/12/02/use-local-dns-cache-to-speed-up/</link>
		<comments>http://www.rainmoe.com/2009/12/02/use-local-dns-cache-to-speed-up/#comments</comments>
		<pubDate>Wed, 02 Dec 2009 06:36:36 +0000</pubDate>
		<dc:creator>小邪</dc:creator>
				<category><![CDATA[探索 [Explore]]]></category>
		<category><![CDATA[cache]]></category>
		<category><![CDATA[dns]]></category>
		<category><![CDATA[speed]]></category>

		<guid isPermaLink="false">http://www.evlos.org/?p=1292</guid>
		<description><![CDATA[> 一般来说查询一次DNS需要1s的时间，查询几次看起来不多，才几秒而已，但是累积起来就大了。

> 图上是我 24 小时进行查询的网址数，大概 2893 条，也就是说我一天可以节省至少2800s。



<span class="readmore"><a href="http://www.rainmoe.com/2009/12/02/use-local-dns-cache-to-speed-up/" title="使用本地DNS缓存加速上网">阅读全文——共522字</a></span>]]></description>
			<content:encoded><![CDATA[<p>> 一般来说查询一次DNS需要1s的时间，查询几次看起来不多，才几秒而已，但是累积起来就大了。<br />
> 图上是我 24 小时进行查询的网址数，大概 2893 条，也就是说我一天可以节省至少2800s。</p>
<p><img src="http://www.rainmoe.com/wp-content/uploads/old/Capture0562.jpg" /></p>
<p>> 其实对每个网址查询的次数肯定不止一次，那么一天我至少可以节省半个小时对DNS查询的时间。<br />
> 貌似有点吓人，不过至少计算结果是这样子的。所以缓存是好东西哇 O(∩_∩)O，啊，灰常灰常好。</p>
<p><span id="more-1292"></span>1. <strong>使用说明</strong>：</p>
<p>> 下载并运行 Dnsspeeder 即可，他会自动把你的 DNS 服务器设置为 127.0.0.1 的本地地址。<br />
> 左上角的下拉菜单是缓存时间，默认是一个小时，不过我是设置成了 24 小时，效果可能更明显一点。<br />
> 左下角的表示启动时自动隐藏在系统托盘，这样需要开机启动只要勾选并拉到开始菜单的启动项里就好了。</p>
<p>> 缓存 24 小时的弊端是某些网站使用了动态的 IP ，这样会是它们无法被访问。<br />
> 要稍等一下，然后软件图标会变红并自动刷新缓存，再访问就没有问题了。</p>
<p>2. <strong>DnsSpeeder 1.8.0 英文绿色免费版 下载传送门</strong>：</p>
<p>> <a href="http://www.greendown.cn/soft/17468.html">http://www.greendown.cn/soft/17468.html</a></p>
<p>3. <strong>怎样使用效果最大</strong>：</p>
<p>> 使用 OpenDNS 就效果大增了，嘿嘿。因为访问 OpenDNS 不是很快嘛。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rainmoe.com/2009/12/02/use-local-dns-cache-to-speed-up/feed/</wfw:commentRss>
		<slash:comments>26</slash:comments>
		</item>
		<item>
		<title>最近垃圾评论很是猖狂</title>
		<link>http://www.rainmoe.com/2009/11/09/comment-spam-is-rampant/</link>
		<comments>http://www.rainmoe.com/2009/11/09/comment-spam-is-rampant/#comments</comments>
		<pubDate>Mon, 09 Nov 2009 12:15:12 +0000</pubDate>
		<dc:creator>小邪</dc:creator>
				<category><![CDATA[奇客 [Geek]]]></category>
		<category><![CDATA[akimat]]></category>
		<category><![CDATA[cache]]></category>
		<category><![CDATA[comment]]></category>
		<category><![CDATA[plugins]]></category>
		<category><![CDATA[spam]]></category>
		<category><![CDATA[speed]]></category>

		<guid isPermaLink="false">http://www.evlos.org/?p=887</guid>
		<description><![CDATA[> 话说最近垃圾评论超级猖狂的，半天就给我发了61条。

> 而且貌似还都是属于同一个域名下的。嘎嘎，这个人好热情。



<span class="readmore"><a href="http://www.rainmoe.com/2009/11/09/comment-spam-is-rampant/" title="最近垃圾评论很是猖狂">阅读全文——共280字</a></span>]]></description>
			<content:encoded><![CDATA[<p>> 话说最近垃圾评论超级猖狂的，半天就给我发了61条。<br />
> 而且貌似还都是属于同一个域名下的。嘎嘎，这个人好热情。</p>
<p><img src="http://www.rainmoe.com/wp-content/uploads/old/Capture0159.jpg" /></p>
<p>> 然后，我屏蔽了那个域名，很有效的说 O(∩_∩)O 哈哈。<br />
> 好几天一点垃圾评论都没有啦。 ╮(╯▽╰)╭</p>
<p>> 最近老是担心这个拖慢网站速度，那个拖慢网站速度的。没办法，就喜欢高速高效的东西。<br />
> 然后我网站上基本上不引用任何外部网站的东西，像站长统计、微博挂件都不敢放。<br />
> 还把Akimat都关了，貌似每次发评论都要经过它的服务器过滤。<br />
> 然后我开了3个缓存插件，缓存数据库查询、博客页面、博客挂件。<br />
> 嘿嘿，看样子速度还是不错滴，蛮让人满意的，数据库查询到了最低点呢。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rainmoe.com/2009/11/09/comment-spam-is-rampant/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Gzip混开一定要慎重</title>
		<link>http://www.rainmoe.com/2009/11/05/open-many-cache-plugins-isnot-so-good/</link>
		<comments>http://www.rainmoe.com/2009/11/05/open-many-cache-plugins-isnot-so-good/#comments</comments>
		<pubDate>Thu, 05 Nov 2009 11:26:01 +0000</pubDate>
		<dc:creator>小邪</dc:creator>
				<category><![CDATA[探索 [Explore]]]></category>
		<category><![CDATA[cache]]></category>
		<category><![CDATA[gzip]]></category>
		<category><![CDATA[plugins]]></category>
		<category><![CDATA[warning]]></category>

		<guid isPermaLink="false">http://www.evlos.org/?p=870</guid>
		<description><![CDATA[非常感谢林木木告诉我菠萝阁全都是乱码

这个问题很是突兀地奇怪莫名其妙地就冒出来了

然后我马上请在线的几个同学检查 结果有几个正常 另外几个却也都是乱码

<span class="readmore"><a href="http://www.rainmoe.com/2009/11/05/open-many-cache-plugins-isnot-so-good/" title="Gzip混开一定要慎重">阅读全文——共375字</a></span>]]></description>
			<content:encoded><![CDATA[<p>非常感谢<a href="http://immmmm.com/">林木木</a>告诉我菠萝阁全都是乱码<br />
这个问题很是突兀地奇怪莫名其妙地就冒出来了<br />
然后我马上请在线的几个同学检查 结果有几个正常 另外几个却也都是乱码<br />
最后我用Wap上网 显示的也是全都是乱码</p>
<p><img class="alignnone size-full wp-image-875" src="http://www.rainmoe.com/wp-content/uploads/old/Capture00681.jpg" width="600" height="203" /></p>
<p>> 后来干脆关闭了所有缓存插件 马上就正常了<br />
> 实际上是我这次开了三个缓存插件在那里<br />
> 分别是WP-Super-Cache和WP-Widget-Cache还有WP-DB-Cache三个<br />
> 然后就出问题了 全屏乱码输出 三个字 爽透了</p>
<p><span id="more-870"></span>> 本来是想实现超低数据库读取的 结果就郁闷了 ╮（╯▽╰）╭<br />
> 为什么有些人可以有些人不行 我的三个Firefox和Chrome还有IE都是正常的<br />
> 太奇怪了 难道我的博客有贞子在乱钻？</p>
<p>> 后来倒是搞清楚了 原来我的博客原生的Gzip不知道怎么回事开在哪里<br />
> 然后我又打开了WP-Super-Cache的Gzip<br />
> 各位谁要是也全屏乱码 推荐你先检查下是不是Gzip开重复了喔</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rainmoe.com/2009/11/05/open-many-cache-plugins-isnot-so-good/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using memcached (Feed is rejected)
Page Caching using memcached
Database Caching 1/43 queries in 0.030 seconds using memcached
Object Caching 625/724 objects using memcached

Served from: www.rainmoe.com @ 2012-02-09 16:54:53 -->
