wordpress打开缓存_如何选择WordPress缓存解决方案

wordpress打开缓存

This article is part of a series created in partnership with SiteGround. Thank you for supporting the partners who make SitePoint possible.

本文是与SiteGround合作创建的系列文章的一部分。 感谢您支持使SitePoint成为可能的合作伙伴。

You know you need a fast website. Your visitors don’t want to wait, Google rewards speed, and you just want to create the best site you can.

您知道您需要一个快速的网站。 您的访客不想等待,Google会奖励您更快的速度,而您只想创建一个最佳网站即可。

We previously talked about some strategies for speeding your site in our article How to Optimize Your WordPress Site’s Performance. One key strategy we covered in that article is caching.

我们之前在文章如何优化WordPress网站的性能中讨论了一些加快网站速度的策略。 我们在那篇文章中介绍的一项关键策略是缓存。

Once you start googling the topic, you find that it becomes quite complex, and there are a lot of caching solutions out there. Which one should you choose?

开始搜索该主题后,您会发现它变得非常复杂,并且那里有很多缓存解决方案。 您应该选择哪一个?

In this article we’ll explain the options and help you make a decision.

在本文中,我们将解释选项并帮助您做出决定。

缓存如何加速我的网站? (How Does Caching Speed Up My Site?)

There are a lot of benefits to using WordPress for your website. It’s easy to add new posts, tweak the way your site looks, and add new functionality. It’s definitely the way to go, and why it’s the most popular CMS in the world, powering almost 75 million sites, or over 25% of the web.

在您的网站上使用WordPress有很多好处。 添加新帖子,调整网站外观以及添加新功能很容易。 这绝对是必经之路,也是为什么它成为全球最受欢迎的CMS,可为将近7500万个网站或超过25%的网站提供支持。

But all of that convenience comes at a price. Your web site has more work to do when someone visits your site, making it slower. Scripts need to be run, your database accessed, your theme displayed, your plugins run.

但是所有这些便利都是有代价的。 当有人访问您的网站时,您的网站需要做更多的工作,因此速度变慢。 需要运行脚本,访问数据库,显示主题,运行插件。

Caching changes all that.

缓存改变了这一切。

A cache is a place to store temporary data. It takes your dynamic, easy-to-change website, and stores it as static HTML files, which are much faster to read. Each time your site is modified, the cache needs to be cleared and regenerated, which is normally triggered by a WordPress plugin.

缓存是存储临时数据的地方。 它可以将您的动态网站,易于更改的网站存储为静态HTML文件,这些文件的读取速度更快。 每次修改站点时,都需要清除并重新生成缓存,这通常是由WordPress插件触发的。

缓存有什么好处? (What Are the Benefits of Caching?)

There are three major benefits to using a WordPress cache:

使用WordPress缓存有三个主要好处:

  1. Caching enhances the speed and performance of your website, particularly page load times. Your visitors will spend less time waiting, and more time reading.

    缓存可以提高网站的速度和性能,尤其是页面加载时间。 您的访客将花更少的时间在等待上,而花更多的时间在阅读上。
  2. Caching reduces the load on your web server. Your database doesn’t need to be accessed as often, and less system memory is used. This can make a big difference on a limited shared hosting plan.

    缓存减少了Web服务器上的负载。 您无需经常访问数据库,并且使用的系统内存更少。 在有限的共享主机计划上,这可能会有很大的不同。
  3. You will rank better on search engines. All other things being equal, Google punishes slow sites by ranking them lower in search results. Your site will become more discoverable, which may lead to an increase in traffic.

    您将在搜索引擎上排名更高。 在其他所有条件都相同的情况下,Google会通过在搜索结果中排名较低的网站来惩罚缓慢的网站。 您的站点将变得更容易被发现,这可能导致流量增加。

So, should you be using a WordPress caching solution? For most people the answer is a resounding “Yes!” It’s the one thing you can do that give a huge performance boost to your site, especially when you have high traffic.

那么,您应该使用WordPress缓存解决方案吗? 对于大多数人来说,答案是肯定的“是!” 这是您可以做的一件事,它可以极大地提高网站的性能,尤其是在流量较高的情况下。

When shouldn’t you use a cache? When you want your site to display differently to each visitor. One example is an ecommerce site, where the shopping cart will be updated differently for each user.

您什么时候不应该使用缓存? 当您希望网站向每个访问者显示不同的内容时。 一个示例是电子商务站点,在该站点中,每个用户的购物车都将进行不同的更新。

But these are special cases. For most WordPress sites a cache is a great idea.

但是这些是特殊情况。 对于大多数WordPress网站而言,缓存是个好主意。

So where do you get one? There are two options: pre-packaged, or roll your own.

那你从哪儿得到的呢? 有两种选择:预包装或自己包装。

选项1:使用托管服务提供商的自定义缓存解决方案 (Option 1: Use Your Hosting Provider’s Custom Caching Solution)

Some hosting providers have their own custom caching solution, which may involve server-side software plus custom WordPress plugins. These are carefully tweaked to maximize the speed improvement.

一些托管服务提供商拥有自己的自定义缓存解决方案,其中可能涉及服务器端软件以及自定义WordPress插件。 这些都经过仔细调整,以最大程度地提高速度。

If your provider offers such a solution, strongly consider using it. Not only will it save you time and effort, but you’re unlikely to match their results in tuning the cache for maximum speed.

如果您的提供商提供了这样的解决方案,则强烈考虑使用它。 它不仅可以节省您的时间和精力,而且在调整缓存以达到最大速度时,您不太可能匹配它们的结果。

Some examples:

一些例子:

SiteGround’s caching solution is SuperCacher, which is based on NGINX (“Engine X”). It supports HTTPS and is claimed to make your pages load four times faster:

SiteGround的缓存解决方案是SuperCacher ,它基于NGINX (“ Engine X”)。 它支持HTTPS,据称可使您的页面加载速度提高四倍:

The SuperCacher is developed by SiteGround exclusively for our customers. It increases the number of hits a site can handle and boosts the website loading speed. The SuperCacher includes 4 different caching options for maximum optimization of your websites.

SuperCacher由SiteGround专为我们的客户开发。 它增加了网站可以处理的点击次数,并提高了网站的加载速度。 SuperCacher包括4种不同的缓存选项,可最大程度地优化您的网站。

It’s a suite of four different caching solutions (well, actually three for shared hosting):

它是由四个不同的缓存解决方案组成的套件(嗯,实际上是三个用于共享托管):

  1. Static Cache, a caching solution for your static resources which is enabled by default.

    静态缓存,默认情况下启用的静态资源缓存解决方案。
  2. Dynamic Cache, which is effective for dynamic sites powered by WordPress and similar.

    动态缓存,对于由WordPress等驱动的动态网站有效。
  3. Memcached, which caches the results from the database queries .

    Memcached,用于缓存数据库查询的结果。

For best results on your WordPress site, enable all three.

为了在WordPress网站上获得最佳效果,请同时启用这三个功能。

WP Engine call their caching solution Evercache, which is set up and ready to go out of the box. They describe it as their “secret sauce”, and claim will load pages 4-6 times faster. They recommend you don’t use your own caching solution. In fact, they explicitly block the use of many caching plugins.

WP Engine称他们的缓存解决方案Evercache ,它已经设置好并且可以直接使用。 他们将其描述为“秘密调味料”,并声称将页面加载速度提高了4-6倍。 他们建议您不要使用自己的缓存解决方案。 实际上,它们显式地阻止了许多缓存插件的使用。

Because of WP Engine’s EverCache, there is no need for site owners or developers to manage caching plugins. WP Engine takes care of that for you.

由于使用了WP Engine的EverCache,因此站点所有者或开发人员无需管理缓存插件。 WP Engine会为您解决这一问题。

Varnish is a caching solution used by many hosting providers including Bluehost and DreamHost, and it may be part of WP Engine’s secret sauce. It’s fast, but has a major limitation: it doesn’t support HTTPS. Some hosting providers run it in conjunction with NGINX or other software to get around this limitation.

Varnish是许多托管服务提供商(包括Bluehost和DreamHost)使用的缓存解决方案,它可能是WP Engine的秘密武器。 它的速度很快,但有一个主要限制:它不支持HTTPS。 一些托管服务提供商将其与NGINX或其他软件一起运行以解决此限制。

Does your hosting provider offer a caching solution out of the box? Check it out before deciding to install your own cache—it can make your job a lot easier. In fact, one good reason to choose a hosting provider is because they offer a fast and easy-to-use caching solution.

您的托管服务提供商是否提供开箱即用的缓存解决方案? 在决定安装自己的缓存之前先进行检查-它可以使您的工作轻松得多。 实际上,选择托管服务提供商的一个很好的理由是,因为它们提供了一种快速且易于使用的缓存解决方案。

选项2:使用WordPress缓存插件 (Option 2: Use a WordPress Caching Plugin)

If your hosting provider doesn’t provide a caching solution, or you prefer a more DIY approach, you can install a WordPress caching plugin. As a bonus, many of these have features beyond just caching, using techniques we described in our article How to Optimize Your WordPress Site’s Performance.

如果您的托管服务提供商不提供缓存解决方案,或者您更喜欢DIY方法,则可以安装WordPress缓存插件。 值得一提的是,其中许多功能不仅仅具有缓存功能,还使用了我们在如何优化WordPress网站的性能中介绍的技术

Which plugin should you use? Firstly, one that will give you a significant speed boost. Secondly, one that will meet your preference of configurability or ease-of-use. Thirdly, consider cost.

您应该使用哪个插件? 首先,它将大大提高速度。 其次,将满足您对可配置性或易用性的偏爱。 第三,考虑成本。

Two independent benchmark tests done earlier this year (by Design Bombs and Dev Shed) agree on the fastest three WordPress caching plugins out there. They rank the plugins differently, and debates about the best or fastest plugin are fierce and never-ending. But these three perform well, and one of them should do the trick for you.

今年早些时候完成了两项独立的基准测试(由Design BombsDev Shed进行了测试 ),它们对速度最快的三个WordPress缓存插件达成了共识。 他们对插件的排名不同,关于最好或最快的插件的争论激烈而永无止境。 但是这三者表现良好,其中之一应该可以帮到您。

WP火箭 “简单与速度”的价格 (WP Rocket “Simplicity & Speed” at a price)

  • Active installs: used by 233,995 sites

    有效安装:由233,995个站点使用
  • Cost: $39 for a single site, 3 sites $99, unlimited sites $199 (includes one year of updates and support)

    费用:单个站点39美元,三个站点99美元,无限站点199美元(包括一年的更新和支持)
  • All plans come with a 30 day money-back guarantee

    所有计划都提供30天退款保证
  • The fastest caching solution according to some benchmark tests

    根据一些基准测试,最快的缓存解决方案

Don’t waste your time struggling with complex plugin settings. WP Rocket launches upon activation – minimal configuration, immediate results.

不要因为复杂的插件设置而浪费时间。 WP Rocket激活后即启动-最少的配置,立即产生效果。

Features:

特征:

  • Page caching: fast loading for web pages

    页面缓存:快速加载网页
  • Cache preloading: improves indexing by search engines

    缓存预加载:改善搜索引擎的索引编制
  • Images on request: images are loaded only when they come into view, improving the initial page load time

    根据要求提供图像:仅在图像出现时才加载图像,从而缩短了初始页面加载时间
  • Static files compression: HTML, Javascript and CSS files are minified so they can be downloaded quicker

    静态文件压缩:压缩了HTML,Javascript和CSS文件,以便可以更快地下载它们
  • Developer friendly: designed to be easily customized.

    开发人员友好:易于定制。

WordPress的创建者Automattic的WP Super Cache (WP Super Cache by Automattic, creators of WordPress)

  • Active installs: 1+ million

    有效安装次数:1+百万
  • Cost: free

    费用:免费
  • A “Top 3” caching solution according to benchmark tests

    根据基准测试的“前三名”缓存解决方案
  • One of the fastest free caching solutions

    最快的免费缓存解决方案之一

This plugin generates static html files from your dynamic WordPress blog. After a html file is generated your webserver will serve that file instead of processing the comparatively heavier and more expensive WordPress PHP scripts.

该插件从动态WordPress博客生成静态html文件。 生成html文件后,您的网络服务器将提供该文件,而不是处理相对较重且更昂贵的WordPress PHP脚本。

The plugin serves cached files in three ways, and is fast and easy to set up. It’s recommended that most users should enable the following settings:

该插件通过三种方式提供缓存的文件,并且设置简便快捷。 建议大多数用户应启用以下设置:

  1. PHP caching

    PHP缓存
  2. Compress pages

    压缩页面
  3. Don’t cache pages for known users

    不要为已知用户缓存页面
  4. Cache rebuild

    缓存重建
  5. CDN support

    CDN支持
  6. Extra homepage checks.

    额外的首页检查。

W3总缓存 “ WordPress的Web性能优化” (W3 Total Cache “Web Performance Optimization for WordPress”)

  • Active installs: 1+ million

    有效安装次数:1+百万
  • Cost: free

    费用:免费
  • A “Top 3” caching solution according to benchmark tests

    根据基准测试的“前三名”缓存解决方案
  • Another of the fastest free caching solutions

    另一个最快的免费缓存解决方案

W3 Total Cache improves the SEO and user experience of your site by increasing website performance, reducing download times via features like content delivery network (CDN) integration.

W3 Total Cache通过提高网站性能,通过内容交付网络(CDN)集成等功能来减少下载时间,从而改善了网站的SEO和用户体验。

This plugin does more than just caching—it has a feature set similar to WP Rocket. According to the website, those features provide the following benefits:

该插件不仅可以缓存,还具有类似于WP Rocket的功能集。 根据该网站,这些功能具有以下优点:

  • Improved search engine page rankings, especially for mobile-friendly websites and sites that use SSL

    改进的搜索引擎页面排名,尤其是对于适合移动设备访问的网站和使用SSL的网站
  • At least 10x improvement in overall site performance

    网站整体性能提高至少10倍
  • Improved conversion rates and “site performance” which affect your site’s rank on Google.com

    改善的转化率和“网站性能”,这会影响您的网站在Google.com上的排名
  • “Instant” repeat page views: browser caching

    “即时”重复页面浏览:浏览器缓存
  • Optimized progressive render: pages start rendering quickly and can be interacted with more quickly

    优化的渐进式渲染:页面可以快速开始渲染,并且可以更快地进行交互
  • Reduced page load time, increasing visitor time on site

    减少页面加载时间,增加网站访问者时间
  • Improved web server performance, and the ability to sustain high traffic periods

    改进的Web服务器性能以及维持高流量时段的能力
  • Up to 80% bandwidth savings via minify and HTTP compression of HTML, CSS, JavaScript and feeds.

    通过最小化和HTTP压缩HTML,CSS,JavaScript和提要,最多可节省80%的带宽。

是时候做出选择了 (Time to Make a Choice)

Which caching option is best for you? The one that gives you the best balance of:

哪种缓存选项最适合您? 使您达到以下最佳平衡的一种:

  1. Speed and functionality

    速度和功能
  2. Configurability vs. ease-of-use

    可配置性与易用性
  3. Cost.

    成本。

Here are our recommendation.

这是我们的建议。

  • If your web host provides a caching solution, strongly consider using it, especially if you value ease of use. SiteGround, our preferred hosting provider, packages an excellent caching solution into their affordable hosting plans, and would be an excellent choice.

    如果您的Web主机提供了缓存解决方案,则强烈考虑使用它,尤其是在您重视易用性的情况下。 我们首选的托管服务提供商 SiteGround将出色的缓存解决方案打包到其负担得起的托管计划中,将是绝佳的选择。

  • WP Rocket is fast and easy to use—you can be set up in 3-4 minutes. If you don’t mind the $39 price point, it might be perfect for you.

    WP Rocket快速且易于使用-您可以在3-4分钟内完成设置。 如果您不介意39美元的价位,对您来说可能是完美的选择。
  • On the other hand, if you prefer a user-friendly solution that’s free, choose WP Super Cache. It was written by the team that know WordPress best, and because it has less options, is easier to set up.

    另一方面,如果您喜欢免费的用户友好解决方案,请选择WP Super Cache。 它是由最了解WordPress的团队编写的,并且由于它的选项较少,因此更易于设置。
  • Or if you prefer a free solution that’s more configurable, choose W3 Total Cache. It has features beyond caching that may save you from installing additional plugins.

    或者,如果您更喜欢可配置的免费解决方案,请选择W3 Total Cache。 它具有缓存以外的功能,可能使您无需安装其他插件。

Which caching solution do you prefer? Why? Did we leave out your favorite? Let us know in the comment section below.

您更喜欢哪种缓存解决方案? 为什么? 我们是否遗漏了您的最爱? 在下面的评论部分让我们知道。

翻译自: https://www.sitepoint.com/choose-wordpress-caching-solution/

wordpress打开缓存