3 ms·
Is the cache part of WordPress or something built around it?
by polio 4y ago
Is the cache part of WordPress or something built around it?
- SahAssar 4y agoIt can be both, but you can have php-level caching (opcache or similar, mainly for making the actual php code faster), wordpress cache plugins (not that great at speed but they can invalidate their cache on changes), reverse-proxy level cache (varnish/nginx or similar, fast but usually requires some work to do invalidation) and perhaps a CDN cache (usually with the cache time set by wordpress via a cache-control header). For cases like this at least having a nginx/varnish cache with a use use-stale-on-error policy would have been helpful. Even a very short cache-time like 1 second would probably have given a decent hitrate.
- freedomben 4y agoI've started using the Simply Static plugin a lot because you can get content-aware cache invalidation and also have nginx serve the files directly so you can avoid hitting any php. You do have to configure nginx properly though or else it won't work, but I didn't find it terribly difficult to do (although I'm already pretty familiar with nginx). Adding varnish is something on my list to try as well, though so far performance has been beyond "good enough" so it's hard to justify the time investment to adding varnish :-)
- neurostimulant 4y agoIf you have to use a cache plugin on wordpress, it's much easier to use apache instead of nginx because all cache plugins can automatically configure the cache behavior using automatically generated .htaccess files instead of requiring you to manually configure nginx yourself. Nginx does have speed advantage over apache (and other advantages as well), but if majority of your traffics are going to get served by a static cache, might as well use apache because it's not particularly slower at serving static files compared to nginx, while saving you some configuration headaches.