Title: WP REST API Cache
Author: airesvsg
Published: <strong>2016 年 5 月 24 日</strong>
Last modified: 2018 年 3 月 3 日

---

搜索插件

![](https://ps.w.org/wp-rest-api-cache/assets/banner-772x250.jpg?rev=1423638)

**该插件尚未通过WordPress的最新3个主要版本进行测试**。 当与较新版本的WordPress一起
使用时，可能不再受到维护或支持，并且可能会存在兼容性问题。

![](https://ps.w.org/wp-rest-api-cache/assets/icon-256x256.jpg?rev=1423638)

# WP REST API Cache

 作者：[airesvsg](https://profiles.wordpress.org/airesvsg/)

[下载](https://downloads.wordpress.org/plugin/wp-rest-api-cache.1.2.0.zip)

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

 [支持](https://wordpress.org/support/plugin/wp-rest-api-cache/)

## 描述

Enable caching for WordPress REST API and increase speed of your application

**See details on GitHub:** http://github.com/airesvsg/wp-rest-api-cache

## 安装

 1. Copy the `wp-rest-api-cache` folder into your `wp-content/plugins` folder
 2. Activate the `WP REST API Cache` plugin via the plugin admin page

## 常见问题

  Installation Instructions

 1. Copy the `wp-rest-api-cache` folder into your `wp-content/plugins` folder
 2. Activate the `WP REST API Cache` plugin via the plugin admin page

## 评价

![](https://secure.gravatar.com/avatar/cc1fa8fe3014e161d0e87594f94ec34245f540ac6a4b0b0ae43d6408da5f3af9?
s=60&d=retro&r=g)

### 󠀁[It is messed up](https://wordpress.org/support/topic/it-is-messed-up/)󠁿

 [arindam4u](https://profiles.wordpress.org/arindam4u/) 2019 年 7 月 25 日

I have a large wordpress site. Many cache calls received. How to clear cache for
the only post which is updated.

![](https://secure.gravatar.com/avatar/173589bce0f6860484e5384fc5923284986a4dc7bf5f40061e585dcfceae5f10?
s=60&d=retro&r=g)

### 󠀁[Breaks API response](https://wordpress.org/support/topic/breaks-api-response/)󠁿

 [peronczyk](https://profiles.wordpress.org/peronczyk/) 2018 年 11 月 15 日

This plugin breaks API response by messing up returned JSON and increases its size(
eg.: 100KB -> 5MB).

![](https://secure.gravatar.com/avatar/1894e91b32c9f80d8f30a42d360af6983a507f1cf2c621b7c9a0a0de14e011c5?
s=60&d=retro&r=g)

### 󠀁[Does not support closures](https://wordpress.org/support/topic/does-not-support-closures/)󠁿

 [Xedin Unknown](https://profiles.wordpress.org/xedinunknown/) 2018 年 5 月 22 日
1 回复

This plugin appears to cache REST API responses based on their handlers, not on 
their request. When a handler is written in the form of an anonymous function, it
doesn’t work, producing a fatal error. Truly, except with the help of a couple of
PHP libraries, serialization of closures is not possible in PHP at all. Endpoint
authors cannot be expected to use named functions (bleh!) just because of this limitation.
Another major problem is that the plugin apparently uses WP transients to cache 
the response body. No other caching medium can be used. Not sure why I would cache
a 1MB JSON response in a transient in the DB – a file seems to be a much better 
way for that. Finally… why re-invent the wheel? Use PSR-16.

![](https://secure.gravatar.com/avatar/54720c3992c268adc09207a515d52ba7a2aecf3b38b5df0f38e3a4bf3724aaf2?
s=60&d=retro&r=g)

### 󠀁[Works great, very fast API calls now 🌟](https://wordpress.org/support/topic/works-great-very-fast-api-calls-now-%f0%9f%8c%9f/)󠁿

 [Graeme Fulton](https://profiles.wordpress.org/graylien/) 2017 年 3 月 18 日

It seems about 8 times faster to make API calls now using this plugin. 5 Stars all
the way!

![](https://secure.gravatar.com/avatar/02249463211397de0cd7a2f8e2347a61eee04cd6f3b3047f86f3750b878b0347?
s=60&d=retro&r=g)

### 󠀁[Brilliant. Speeds up API immensely](https://wordpress.org/support/topic/brilliant-speeds-up-api-immensely/)󠁿

 [jonnyboggon](https://profiles.wordpress.org/jonnyboggon/) 2017 年 3 月 3 日

Remember to set WP_DEBUG to false in wp-config or will not work.

![](https://secure.gravatar.com/avatar/9f7e2e99176541fbf1e08002ad73b4064db8b7dbe04259bd52c36dbcfaefbee2?
s=60&d=retro&r=g)

### 󠀁[Not working with _embed](https://wordpress.org/support/topic/not-working-with-_embed/)󠁿

 [redprogrammer](https://profiles.wordpress.org/redprogrammer/) 2017 年 2 月 9 日
7 回复

there is a bug and the owner is not interested in

 [ 阅读所有7条评价 ](https://wordpress.org/support/plugin/wp-rest-api-cache/reviews/)

## 贡献者及开发者

「WP REST API Cache」是开源软件。 以下人员对此插件做出了贡献。

贡献者

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

[帮助将「WP REST API Cache」翻译成简体中文。](https://translate.wordpress.org/projects/wp-plugins/wp-rest-api-cache)

### 对开发感兴趣吗?

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

## 更新日志

#### 1.2.0

adding rest_cache_headers filter

#### 1.1.0

improving the arguments of filters

#### 1.0.0

initial version

## 额外信息

 *  版本 **1.2.0**
 *  最后更新：**8 年前**
 *  活跃安装数量 **200+**
 *  WordPress 版本 ** 4.3 或更高版本 **
 *  已测试的最高版本为 **4.9.29**
 *  语言
 * [English (US)](https://wordpress.org/plugins/wp-rest-api-cache/)
 * 标签
 * [api](https://cn.wordpress.org/plugins/tags/api/)[cache](https://cn.wordpress.org/plugins/tags/cache/)
   [rest](https://cn.wordpress.org/plugins/tags/rest/)[wp-api](https://cn.wordpress.org/plugins/tags/wp-api/)
   [wp-rest-api](https://cn.wordpress.org/plugins/tags/wp-rest-api/)
 *  [高级视图](https://cn.wordpress.org/plugins/wp-rest-api-cache/advanced/)

## 评级

 3.4 星（最高 5 星）。

 *  [  4 条 5 星评价     ](https://wordpress.org/support/plugin/wp-rest-api-cache/reviews/?filter=5)
 *  [  0 条 4 星评价     ](https://wordpress.org/support/plugin/wp-rest-api-cache/reviews/?filter=4)
 *  [  0 条 3 星评价     ](https://wordpress.org/support/plugin/wp-rest-api-cache/reviews/?filter=3)
 *  [  1 条 2 星评价     ](https://wordpress.org/support/plugin/wp-rest-api-cache/reviews/?filter=2)
 *  [  2 条 1 星评价     ](https://wordpress.org/support/plugin/wp-rest-api-cache/reviews/?filter=1)

[Your review](https://wordpress.org/support/plugin/wp-rest-api-cache/reviews/#new-post)

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

## 贡献者

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

## 支持

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

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

## 捐助

您愿意支持这个插件的发展吗?

 [ 捐助此插件 ](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=airesvsg%40gmail%2ecom&lc=BR&item_name=Aires%20Goncalves&no_note=0&currency_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHostedGuest)