這個外掛並未在最新的 3 個 WordPress 主要版本上進行測試。開發者可能不再對這個外掛進行維護或提供技術支援,並可能會與更新版本的 WordPress 產生使用上的相容性問題。

WP Fragment Cache

描述

This plugin requires PHP version 5.3.6 or greater and can’t be activated without a persistent backend for the WordPress Object Cache.

Adds ability to cache particular sections of your site. This plugin is for people who can’t use a full page cache or for sites with lots of pages and with frequent changes.
It can cache entire loops with the WP_Query(bypassing the database queries) or only the html output of the loop and if the query results has changed(comment added, post was edited, postmeta has changed …) the cache will be invalidated and regenerated.

Example usage:

<?php if ( ! WP_Fragment_Cache::output( $wp_query_or_blockname, $duration ) ): ?>

  //content to be cached

  <?php WP_Fragment_Cache::store(); ?>
<?php endif; ?>

Parameters:

$wp_query_or_blockname
(mixed/string) (optional) a WP_Query(WP_Comment_Query) result or a string.
Default: the file and the line where the call was initiated(e.g. widgets/most-commented.php:18).

$duration
(int/string) (optional) Defines how many seconds to keep the cache for. If you pass 0 the cache will not expire. If you pass the string “only_today” the cache will expire at the end of the current day. You can use WordPress Time Constants.
Default: 86400 (one day).

Advanced usage:

See the wiki pages on GitHub

安裝

  1. You should have a persistent backend for the WordPress Object Cache enabled. This plugin can’t be activated without a persistent cache.
  2. Download the plugin and unzip.
  3. Upload them to /wp-content/plugins/ directory on your WordPress installation.
  4. Then activate the WP Fragment Cache plugin from Plugins page.
  5. Edit your template files to include WP Fragment Cache. See the Description tab

常見問題

I can’t activate the plugin.

Please make sure that you have a persistent backend for the WordPress Object Cache enabled.

評價

There are no reviews for this plugin.

貢獻者及開發者

“WP Fragment Cache” 是一個開源的軟體。以下的人對這個外掛作出了貢獻。

貢獻者

將 WP Fragment Cache 外掛本地化為台灣繁體中文版。

對開發相關資訊感興趣?

任何人均可瀏覽程式碼、查看 SVN 存放庫,或透過 RSS 訂閱開發記錄

修改日誌

1.0.4

  • PHP 5.3 compatibility fix.
  • Make PHP version 5.3.6 minimal requirement.

1.0.3

  • Fix example usage code block.

1.0.2

  • Improve the description of the persistent cache requirement to avoid any confusion.

1.0.1

  • Add README and CHANGELOG.
  • Add link for Advanced usage.

1.0.0

  • Initial release.