Title: WP Fragment Cache
Author: mariuspass
Published: <strong>2014 年 4 月 26 日</strong>
Last modified: 2014 年 6 月 18 日

---

搜尋外掛

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

![](https://s.w.org/plugins/geopattern-icon/wp-fragment-cache.svg)

# WP Fragment Cache

 由 [mariuspass](https://profiles.wordpress.org/mariuspass/) 開發

[下載](https://downloads.wordpress.org/plugin/wp-fragment-cache.zip)

 * [詳細資料](https://tw.wordpress.org/plugins/wp-fragment-cache/#description)
 * [使用者評論](https://tw.wordpress.org/plugins/wp-fragment-cache/#reviews)
 *  [安裝方式](https://tw.wordpress.org/plugins/wp-fragment-cache/#installation)
 * [開發資訊](https://tw.wordpress.org/plugins/wp-fragment-cache/#developers)

 [技術支援](https://wordpress.org/support/plugin/wp-fragment-cache/)

## 外掛說明

**This plugin requires PHP version 5.3.6 or greater and can’t be activated without
a [persistent backend](https://codex.wordpress.org/Class_Reference/WP_Object_Cache#Persistent_Cache_Plugins)
for the [WordPress Object Cache](https://codex.wordpress.org/Class_Reference/WP_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](https://codex.wordpress.org/Transients_API#Using_Time_Constants).
Default: 86400 (one day).

### Advanced usage:

See the [wiki pages](https://github.com/mariuspass/wp-fragment-cache/wiki) on GitHub

## 安裝方式

 1. You should have a [persistent backend](https://codex.wordpress.org/Class_Reference/WP_Object_Cache#Persistent_Cache_Plugins)
    for the [WordPress Object Cache](https://codex.wordpress.org/Class_Reference/WP_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](https://wordpress.org/extend/plugins/wp-fragment-cache/)

## 常見問題集

  I can’t activate the plugin.

Please make sure that you have a [persistent backend](https://codex.wordpress.org/Class_Reference/WP_Object_Cache#Persistent_Cache_Plugins)
for the [WordPress Object Cache](https://codex.wordpress.org/Class_Reference/WP_Object_Cache)
enabled.

## 使用者評論

這個外掛目前沒有任何使用者評論。

## 參與者及開發者

以下人員參與了開源軟體〈WP Fragment Cache〉的開發相關工作。

參與者

 *   [ mariuspass ](https://profiles.wordpress.org/mariuspass/)

[將〈WP Fragment Cache〉外掛本地化為台灣繁體中文版](https://translate.wordpress.org/projects/wp-plugins/wp-fragment-cache)

### 對開發相關資訊感興趣？

任何人均可[瀏覽程式碼](https://plugins.trac.wordpress.org/browser/wp-fragment-cache/)、
查看 [SVN 存放庫](https://plugins.svn.wordpress.org/wp-fragment-cache/)，或透過 
[RSS](https://plugins.trac.wordpress.org/log/wp-fragment-cache/?limit=100&mode=stop_on_copy&format=rss)
訂閱[開發記錄](https://plugins.trac.wordpress.org/log/wp-fragment-cache/)。

## 變更記錄

#### 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.

## 中繼資料

 *  版本 **1.0.4**
 *  最後更新 **12 年前**
 *  啟用安裝數 **10+**
 *  WordPress 版本需求 ** 3.7.0 或更新版本 **
 *  已測試相容的 WordPress 版本 **3.9.40**
 *  語言
 * [English (US)](https://wordpress.org/plugins/wp-fragment-cache/)
 * 標籤:
 * [cache](https://tw.wordpress.org/plugins/tags/cache/)[cache block](https://tw.wordpress.org/plugins/tags/cache-block/)
   [caching](https://tw.wordpress.org/plugins/tags/caching/)[output caching](https://tw.wordpress.org/plugins/tags/output-caching/)
   [performance](https://tw.wordpress.org/plugins/tags/performance/)
 *  [進階檢視](https://tw.wordpress.org/plugins/wp-fragment-cache/advanced/)

## 評分

這個項目尚無任何評論記錄。

[撰寫評分](https://wordpress.org/support/plugin/wp-fragment-cache/reviews/#new-post)

[查看全部使用者評論](https://wordpress.org/support/plugin/wp-fragment-cache/reviews/)

## 參與者

 *   [ mariuspass ](https://profiles.wordpress.org/mariuspass/)

## 技術支援

使用者可在技術支援論壇提出意見反應或使用問題。

 [檢視技術支援論壇](https://wordpress.org/support/plugin/wp-fragment-cache/)