2

I am planning to use caching for my website (W3 total cache plugin) and I was wondering whether the cached files will be save on visitors personal computers or not?

I know that browsers also use caching, that files are saved on the personal computers (as I think). Is there a difference between this kind of caching and the one used for websites to increase their speed?

Stephen Ostermiller
  • 98,758
  • 18
  • 137
  • 361

1 Answers1

1

It depends on the type of cache. Simply put, you've got two types of caching:

  • Client side caching.
  • Server side caching.

Client side caching, which involves the saving of files onto the user's computer:

  • CSS, images and JS files. These will be saved in the browser cache so that the user doesn't have to repeatedly download the same files from your server.
  • HTML, which can be achieved through some of the various HTTP cache headers.

Server side caching is different, as the files are stored on your server (obviously). This includes:

  • PHP bytecode. Whenever a PHP file is parsed, it is compiled into bytecode. By default, PHP will parse each file as though it is new. Because this is wasteful (PHP files don't change that much), many webmasters and server admins will cache the resulting bytecode and serve it up until the file in question changes (Look up OPcache). Implementing a bytecode cache will typically lower the amount of resources that your server is using, simply because your PHP files are not being parsed on every request.
  • Object caching. This is when the results of database queries are stored in the server's memory, using a daemon such as Memcached or Redis, etc.

When optimizing the load times of your website, it is best to use both client-side caching and server-side caching.

Note: Plugins such as W3 total cache will use file-based caching if a bytecode / object cache isn't installed. This means that physical files will be stored on your server.

Wexford
  • 2,319
  • 10
  • 13
  • Thanks for the information (Y) ..... I am assuming as (W3 total cache) is used for speeding up the website, so is it a Client Side Caching? or does browsers cache files on visitors computers even if I am not using caching for my website ?? – Osama Numan Nov 07 '14 at 19:36
  • Browser's will cache client-side resources pretty aggressively. However, W3 Total Cache will allow you to implement server-side caching, which will obviously speed up your website. Personally, I think that all Wordpress installations should have a caching plugin installed, simply because page load speed matters in terms of SEO. – Wexford Nov 07 '14 at 19:41
  • Thanks A LOT!! just correct me if I am wrong ... I believe now that browsers are caching files on client's side not depending on my side if using caching or not, right? – Osama Numan Nov 07 '14 at 19:47
  • No. Browsers should be caching resources by default. You can, however, bust this cache if you want to (look up cache busting). – Wexford Nov 07 '14 at 19:49
  • Please excuse my ignorance :> what I meant is that even if I am not using (W3 total cache) or any caching plugin, browsers are still caching on client's side, right? that my (W3 Plugin) will help only for my side, not related to clients side whatsoever ?? sorry again for asking too much :) but I want is just to check if in case I am using W3 plugin, will it cause the storage of cached files on clients PC or the browser is the cause ? – Osama Numan Nov 07 '14 at 20:05
  • @OsamaNuman Yes you are right most browsers will cache CSS, JS and Images. W3 total cache stores the outputted HTML from WordPress so that when someone requests that page your server doesn't need to run all the wordpress database functions, it just gives the HTML file. This plugin also updates cached HTML files when anything is published in the admin that should affect them – Bill Nov 08 '14 at 03:42
  • @Billy thanks for answering :) one thing: you mentioned that W3 stores the outputted HTML from WP ... where is it stored ? on client's PC ?? – Osama Numan Nov 08 '14 at 09:17
  • @OsamaNuman No on the server as an HTML file – Bill Nov 09 '14 at 04:52