Title: Jinx Fast-Cache
Author: Lukas Rydygel
Published: <strong>2022 年 2 月 10 日</strong>
Last modified: 2026 年 10 月 6 日

---

搜索插件

![](https://ps.w.org/jinx-fast-cache/assets/banner-772x250.jpg?rev=2676361)

![](https://ps.w.org/jinx-fast-cache/assets/icon-256x256.png?rev=2676361)

# Jinx Fast-Cache

 作者：[Lukas Rydygel](https://profiles.wordpress.org/lugat/)

[下载](https://downloads.wordpress.org/plugin/jinx-fast-cache.zip)

 * [详情](https://cn.wordpress.org/plugins/jinx-fast-cache/#description)
 * [评价](https://cn.wordpress.org/plugins/jinx-fast-cache/#reviews)
 *  [安装](https://cn.wordpress.org/plugins/jinx-fast-cache/#installation)
 * [开发进展](https://cn.wordpress.org/plugins/jinx-fast-cache/#developers)

 [支持](https://wordpress.org/support/plugin/jinx-fast-cache/)

## 描述

Jinx Fast-Cache provides a simple but highly efficient way to implement full-page
caching. It generates static HTML files of your pages, which are then served directly
by your web server (Apache or Nginx).

By bypassing the entire PHP process and database queries, your server load is significantly
reduced and your website response time becomes near-instant. Unlike many other plugins,
Jinx Fast-Cache is built with a developer-first approach, working primarily with
URLs and offering deep integration via filters and actions.

### Usage

### Server Configuration

To serve the cached files directly, you must add rewrite rules to your server configuration.

**For Apache (.htaccess):**
 The plugin will attempt to modify your `.htaccess` 
automatically. If it fails, add this manually:

    ```
    # BEGIN Jinx Fast-Cache
    RewriteEngine On
    RewriteBase /
    RewriteCond %{DOCUMENT_ROOT}/wp-content/jinx-fast-cache/%{HTTP_HOST}/%{REQUEST_URI}/%{QUERY_STRING}/index.html -s
    RewriteCond %{REQUEST_METHOD} GET
    RewriteRule .* /wp-content/jinx-fast-cache/%{HTTP_HOST}/%{REQUEST_URI}/%{QUERY_STRING}/index.html [L]
    # END Jinx Fast-Cache
    ```

**For Nginx:**
 Add the following logic to your server block:

    ```
    set $cache_path false;
    if ($request_method = GET) {
      set $cache_path /wp-content/jinx-fast-cache/$host/$uri/$args/index.html;
    }
    location / {
      try_files $cache_path $uri $uri/ /index.php?$query_string;
    }
    ```

### Cache Management

 * **Admin Bar:** You can flush (clear), warm (generate), or refresh (flush & warm)
   single or multiple URLs directly from the admin bar.
 * **Automatic Updates:** Posts are automatically “warmed” after saving and “flushed”
   when deleted or set to draft.
 * **Background Processing:** The warming process uses a background queue handled
   via WordPress Cron to ensure server stability. Single post warming skips the 
   queue for immediate results.
 * **Plugin Updates:** The cache is automatically refreshed after the plugin is 
   updated.

### Developer API

Jinx Fast-Cache is highly extensible. While a settings panel is available, developers
can fine-tune every detail via filters and actions.

### 1. Filters

 * **jinx_fast_cache_active**: Toggle caching for specific conditions (default: 
   false).
 * **jinx_fast_cache_post_types**: Define which post types should be cached (default:‘
   page’ and ‘publicly_queryable’ types).
 * **jinx_fast_cache_posts**: Filter the specific list of post objects to be cached.
 * **jinx_fast_cache_taxonomies**: Define which taxonomies are cacheable.
 * **jinx_fast_cache_terms**: Filter the specific list of terms to be cached.
 * **jinx_fast_cache_output**: Modify the raw HTML content before it is saved to
   the cache file.
 * **jinx_fast_cache_minify**: Enable/disable HTML minification (default: false).
 * **jinx_fast_cache_flush**: Define additional related URLs that should be cleared
   when a specific page is flushed.
 * **jinx_fast_cache_warm**: Define additional related URLs that should be preloaded
   when a specific page is warmed.
 * **jinx_fast_cache_queue_interval**: Adjust the cron task frequency for the warming
   queue (default: 60s).
 * **jinx_fast_cache_queue_size**: Adjust the batch size per cron task (default:
   10). Set to `<= 0` to process everything at once (Caution: High server load).
 * **jinx_fast_cache_gc_interval**: Adjust the Garbage Collector frequency to remove
   invalid files (default: 60s).
 * **jinx_fast_cache_ignore_logged_in_users**: Toggle caching for logged-in users(
   default: true).
 * **jinx_fast_cache_ignore_404**: Do not cache 404 error pages (default: true).
   Cached pages are served by the web server with status 200, so caching 404 pages
   is not recommended.
 * **jinx_fast_cache_query_params**: Filter the query parameters which are part 
   of the cache key. Ignored parameters (default: common tracking parameters like`
   utm_source`, `gclid`, `fbclid`) are removed here. Return `__return_empty_array`
   to ignore all parameters.
 * **jinx_fast_cache_query_mode**: Define if requests with query parameters are 
   cached: `none` (default, do not cache), `allowed` (only if all parameters are
   allowed) or `all` (cache every query string – every distinct query string creates
   its own cache file).
 * **jinx_fast_cache_allowed_query_params**: Define the allowed query parameters
   for the `allowed` mode (default: `[]`).
 * **jinx_fast_cache_capability**: Capability required to flush, warm or refresh
   the cache and to see the admin bar menu and columns (default: `manage_options`).
 * **jinx_fast_cache_warm_request_args**: Filter the arguments of the HTTP requests
   used for warming (default: `['timeout' => 30, 'redirection' => 0, 'sslverify'
   => apply_filters('https_local_ssl_verify', false)]`).
 * **jinx_fast_cache_refresh_on_upgrade**: Toggle the full cache refresh after plugin
   updates (default: true).
 * **jinx_fast_cache_ttl**: Define the cache lifetime (TTL). Supports seconds (e.
   g., 3600) or strings (e.g., ’12 hours’, ‘1 week’).
 * **jinx_fast_cache_defer_js**: Enable/disable JavaScript deferring (default: false).
 * **jinx_fast_cache_defer_js_excludes**: Define array of script handles or URLs
   to exclude from deferring (default: `['jquery', 'jquery-core']`).
 * **jinx_fast_cache_cleanup_jquery_migrate**: Enable/disable removing `jquery-migrate.
   min.js` (default: false).
 * **jinx_fast_cache_cleanup_emojis**: Enable/disable removing WordPress emoji scripts
   and styles (default: false).
 * **jinx_fast_cache_cleanup_embeds**: Enable/disable removing WordPress oEmbed 
   scripts (default: false).
 * **jinx_fast_cache_cleanup_head**: Enable/disable removing unnecessary `<head>`
   meta tags (default: false).
 * **jinx_fast_cache_precompress**: Enable/disable static Gzip (.gz) and Brotli (.
   br) pre-compression (default: false).
 * **jinx_fast_cache_preload_lcp**: Enable/disable LCP first image priority and 
   featured image preload (default: false).
 * **jinx_fast_cache_async_css**: Enable/disable asynchronous CSS loading via `rel
   ="preload"` (default: false).
 * **jinx_fast_cache_async_css_excludes**: Define array of stylesheet handles or
   URLs to exclude from asynchronous loading (default: `[]`).
 * **jinx_fast_cache_inline_css**: Enable/disable inlining small local CSS files
   directly into HTML (default: false).
 * **jinx_fast_cache_inline_css_max_size**: Define maximum file size in KB for inlining
   CSS (default: 20).
 * **jinx_fast_cache_delay_js**: Enable/disable delaying JavaScript execution until
   user interaction (default: false).
 * **jinx_fast_cache_delay_js_scripts**: Define array of keywords to delay only 
   specific scripts (default: `[]`).
 * **jinx_fast_cache_delay_js_excludes**: Define array of keywords or script handles
   to exclude from delay execution (default: `[]`).
 * **jinx_fast_cache_minify_inline_assets**: Enable/disable minifying inline style
   and script blocks (default: false).
 * **jinx_fast_cache_instant_page**: Enable/disable Speculation Rules API for instant
   internal link transitions (default: false).
 * **jinx_fast_cache_speculation_rules**: Filter the Speculation Rules array structure.

### 2. Dynamic Injections (AJAX)

Since static HTML files cannot execute PHP, Jinx allows you to “inject” dynamic 
content (like a user’s name or a shopping cart) via AJAX.

**Injecting a Template Part:**

    ```
    do_action('jinx_fast_cache_inject_template', 'template-slug', 'Placeholder text...');
    ```

**Injecting via Function Call:**

You can call any public function or class method:

    ```
    do_action('jinx_fast_cache_inject', 'date', ['Y']);
    do_action('jinx_fast_cache_inject', ['MyClass', 'myMethod'], [$arg1, $arg2]);
    ```

**Using Shortcodes:**

    ```
    [jinx_fast_cache_inject placeholder="Loading..."] Your dynamic content here [/jinx_fast_cache_inject]
    ```

**JS Callbacks:**

Trigger custom JavaScript after the content has been injected:

    ```
    $('.element').on('jinx-fast-cache-inject', (e) => { /* Handle injection */ });
    element.addEventListener('jinx-fast-cache-inject', (e) => { /* Handle injection */ }, false);
    ```

### 3. URL Tags & Relations

Tags are a powerful way to link multiple URLs together. If one URL is flushed, all
other URLs sharing the same tag will also be purged. This is perfect for linking
a “Latest Posts” widget on your homepage to your single post entries.

**Via Shortcode:**

    ```
    [jinx_fast_cache tags="news,homepage"]
    ```

**Via Action:**

    ```
    do_action('jinx_fast_cache', ['tags' => 'tag1,tag2']);
    do_action('jinx_fast_cache', ['tags' => ['tag1', 'tag2']]);
    ```

### 4. Per-Page Cache Duration (TTL)

Override the global TTL for specific high-traffic or highly dynamic pages.

**Via Shortcode:**

    ```
    [jinx_fast_cache ttl="3600"] or `[jinx_fast_cache ttl="12 hours"]`
    ```

**Via Action:**

    ```
    do_action('jinx_fast_cache', ['ttl' => 3600]);
    ```

**Combined Call (Tags + TTL):**

    ```
    do_action('jinx_fast_cache', ['ttl' => 3600, 'tags' => ['foo', 'bar']]);<h3>Roadmap</h3>
    ```

– [x] Release the plugin
 – [x] Add HTML minification for output – [x] Allow injection
of dynamic rendered templates using ajax requests – [x] Add taxonomies – [x] Provide
scheduled tasks – [x] Add admin columns for cache status – [x] Provide exclude option
for posts and terms in backend – [x] Add multisite support – [x] Flush and warm 
after update complete – [x] Add possibility to ignore 404 – [x] Allow query params
to be excluded or totally ignored – [x] Provide cache duration – [x] Provide admin
panel to change options – [x] Add tags to flush related pages – [x] Add shortcode
for injects – [x] Add JS events for injects – [x] Gutenberg inject block

## 区块

该插件提供了 1 个区块.

 *   ⚡ Jinx Fast-Cache Inject

## 安装

 1. Unzip the downloaded package.
 2. Upload the `jinx-fast-cache` folder to the `/wp-content/plugins/` directory.
 3. Activate the plugin through the ‘Plugins’ menu in WordPress.
 4. **Important:** Configure your server rewrite rules (see “Usage”) to serve the static
    files.

## 评价

此插件暂无评价。

## 贡献者及开发者

「Jinx Fast-Cache」是开源软件。 以下人员对此插件做出了贡献。

贡献者

 *   [ Lukas Rydygel ](https://profiles.wordpress.org/lugat/)

[帮助将「Jinx Fast-Cache」翻译成简体中文。](https://translate.wordpress.org/projects/wp-plugins/jinx-fast-cache)

### 对开发感兴趣吗?

您可以[浏览代码](https://plugins.trac.wordpress.org/browser/jinx-fast-cache/)，查看
[SVN仓库](https://plugins.svn.wordpress.org/jinx-fast-cache/)，或通过[RSS](https://plugins.trac.wordpress.org/log/jinx-fast-cache/?limit=100&mode=stop_on_copy&format=rss)
订阅[开发日志](https://plugins.trac.wordpress.org/log/jinx-fast-cache/)。

## 更新日志

#### 1.0.0

 * Security: Cache actions (flush, warm, refresh, toggle) require the `manage_options`
   capability and a valid nonce.
 * Security: Fixed SQL injection in tag lookup, path traversal in the inject endpoint
   and cache poisoning via the Host header.
 * Security: Password protected posts are no longer cached.
 * Fix: Cache is refreshed when saving posts in the block editor (REST API), via
   cron and WP-CLI.
 * Fix: Fatal error when HTML minification is enabled.
 * Fix: Fatal error when injecting templates for logged-in users.
 * Fix: .htaccess conditions (logged-in users, user agents) were only applied to
   the first rule when pre-compression is enabled.
 * Fix: Cache paths for query strings, subdirectory installations and non-ASCII 
   URLs did not match the rewrite rules.
 * Fix: “Do not cache 404 errors” did the opposite. 404 pages are no longer cached
   by default.
 * Fix: CSS optimization broke selectors like `:root :where()`, relative `url()`
   paths and `media` attributes.
 * New: Query string modes (none / allowed / all) and default list of ignored tracking
   parameters. Requests with query strings are no longer cached by default.
 * New: The cache is flushed automatically when the settings are changed.
 * Improvement: Faster flushing of single URLs, cache files are written atomically,
   leftovers of aborted flushes are removed by the garbage collector.

## 额外信息

 *  版本 **1.0.0**
 *  最后更新：**23 分前**
 *  活跃安装数量 **不到10**
 *  WordPress 版本 ** 5.8 或更高版本 **
 *  已测试的最高版本为 **6.9.0**
 *  PHP 版本 ** 8.0 或更高版本 **
 *  语言
 * [English (US)](https://wordpress.org/plugins/jinx-fast-cache/)
 * 标签
 * [cache](https://cn.wordpress.org/plugins/tags/cache/)[fullpage](https://cn.wordpress.org/plugins/tags/fullpage/)
   [html](https://cn.wordpress.org/plugins/tags/html/)[performance](https://cn.wordpress.org/plugins/tags/performance/)
   [static cache](https://cn.wordpress.org/plugins/tags/static-cache/)
 *  [高级视图](https://cn.wordpress.org/plugins/jinx-fast-cache/advanced/)

## 评级

尚未提交反馈。

[您的评价](https://wordpress.org/support/plugin/jinx-fast-cache/reviews/#new-post)

[查看全部评论](https://wordpress.org/support/plugin/jinx-fast-cache/reviews/)

## 贡献者

 *   [ Lukas Rydygel ](https://profiles.wordpress.org/lugat/)

## 支持

有话要说吗？是否需要帮助？

 [查看支持论坛](https://wordpress.org/support/plugin/jinx-fast-cache/)