查看同站点书签
-
wp super cahe功能组件。
添加人:JarodLee 时间:2007-12-19 12:48:25 已有 64 人点击, 0 人评论
希望它能救回我的wordpress博客,目前几乎不能使用了。
WP Super Cache
Introduction
Most WordPress users are familiar with the excellent WP-Cache 2 by Ricardo Galli Granada. It caches the pages of your WordPress blog and delivers them without accessing the database. Unfortunately it still means loading the PHP engine to serve the cached files despite what the wordpress.org wp-cache page says.
WP Super Cache gets around that. When it is installed, html files are generated and they are served without ever invoking a single line of PHP. How fast can your site serve graphic files? That’s (almost) as fast it will be able to serve these cached files. If your site is struggling to cope with the daily number of visitors, or if your site appears on Digg.com, Slashdot or any other popular site then this plugin is for you.
How it works
A classic method of preparing an under powered site for a Digg front page appearance or a Slashdotting has been to manually save copies of dynamically generated pages, and place them in directories that match the permalinks structure. This method of performance enhancement does help servers handle a higher load without crashing, but is only effective when an oncoming rush of traffic can be anticipated. WP-Cache alone, while helpful, is not adequate in many cases, so WP Super Cache was created to effectively mimic the manual page caching method, but to handle it in an automated fashion.
When a visitor who is not logged in, or who has not left a comment, visits they will be served a static HTML page out of the supercache subdirectory within the WordPress cache directory. If you navigate to that directory you can view an exact replica of your permalink structure as well as the HTML files within the directories. To determine if a page has been served out of the Super Cache, view the source and the last line on the page should read <!-- super cache --> or <!-- super cache gz -->.
If a visitor who is logged in or who has left a comment views a cached page, it will be served from the standard WP Cache function and the last line in the source code will read <!-- Cached page served by WP-Cache -->
Features/Changes from WP-Cache
A plugin and hooks system. A common complaint with WP Cache was that hacking was required to make it work nicely with other plugins. Now you can take advantage of the simple plugin system built in to change how or when pages are cached. Use do_cacheaction() and add_cacheaction() like you would with WordPress hooks. Plugins can add their own options to the admin page too.
Works well with WordPress MU in VHOST or non-VHOST configuration. Each blog’s cache files are identified to improve performance.
Normal WP-Cache files are now split in two. Meta files go in their own directory making it much faster to scan and update the cache.
Includes this WP-Cache and protected posts fix.
Automatically disable gzip compression in WordPress instead of dying.
As Akismet and other spam fighting tools have improved, the cache will only be invalidated if a comment is definitely not spam.
A “lock down” button. I like to think of this as my “Digg Proof” button. This basically prepares your site for a heavy digging or slashdotting. It locks down the static cache files and doesn’t delete them when a new comment is made.
Automatic updating of your .htaccess file. (Backup your .htaccess before installing the plugin!)
Don’t super cache any request with GET parameters.
Better version checking of wp-cache-config.php and advanced-cache.php in case you’re using an old one.
Better support for Microsoft Windows.
Properly serve cached static files on Red Hat/Cent OS systems or others that have an entry for gzip in /etc/mime.types.
The Reject URI function now uses regular expressions.
Caveats
If you’re logged in or have left a comment you’ll never see a super-cached page. You’ll see plain old regular WP-Cached pages instead. That’s not so bad since a huge majority of your visitors will never leave a comment.
Mod Rewrite is used to serve the static HTML pages. As fancy permalinks is also a requirement it should already be installed.
Some of the more dynamic aspects of your site’s template won’t refresh quite as quickly. For example, recent comment sidebar plugins.
Some sites have problems serving compressed html files and need extra configuration.
Don’t expect a cheap hosting plan to survive a major traffic spike, even if it is cached!
Remember that dynamic content such as that within the sidebar, will only refresh when the cached pages are refreshed. This timeout value can be modified, but cached files will only be removed if you have a healthy mix of static and dynamic requests.
Some plugins like SK2, Bad Behaviour and others that depend on “fresh” data may not work very well, at least until those plugins support this plugin and clear the cache when required.
Performance Benchmarks
Benchmarks coming soon, but under high load, serving static html files will always trump dynamic PHP requests.
WP Super Cache has also been tested under real world load conditions. The following articles appeared on the Digg front page without issue while running WP Super Cache:
25 Photographs Taken at the Exact Right Time - 5,300+ Diggs (server slowed down a lot, see my note about cheap hosting above!)
13 Amazing Cirque du Soleil Performances - 624+ Diggs
The 10 Craziest Competitive Sports (You Never Heard Of) - 520+ Diggs
Sites using the Super Cache
Here are a few of the sites that used and helped me build and debug WP Super Cache:
My own blogs, Holy Shmoly! and In Photos dot Org.
One Man’s Blog
Edu Blogs tested the cache and helped make it work better with WordPress MU.
Sawse - Stir it Up!
Download and Install
Remove any existing instances of WP Cache, as WP Super Cache is a drop in replacement. Don’t forget to delete the files wp-content/advanced-caching.php and wp-content/wp-cache-config.php.
Download the newest version of the WP Super Cache plugin from the WordPress.org plugin db and follow the instructions contained in the readme.txt file. If you have installed WP-Cache before this shouldn’t be any more difficult.
After installation, go to the WP Super Cache options page and set your desired cache time.
Support queries and requests should be made through the Super Cache forum.
|