0

I have uploaded my new files on my server but it seems the cache has not refreshed as I can still see the same code.

It is the js files that I have changed.

I am using nginx and have also checked set the sendfile to 'Off' but still no joy.

Is there anyway i can clear the cache so i can see the updated files. The server is defintely holding the latest files.

Hope someone can assist.

Bergi
  • 630,263
  • 148
  • 957
  • 1,375
tjhack
  • 1,022
  • 3
  • 20
  • 43
  • Have you tried to include your script with attaching the latest version `?v12` on ``? – Suman Bogati Feb 07 '14 at 15:13
  • there is no versioning on there. The server definitely has the correct copy on there as i did a quick vim on the file. – tjhack Feb 07 '14 at 15:16
  • It is the way through which we can clear cache, in actual there is no any version of file, but it's dummy version(you can put any number). – Suman Bogati Feb 07 '14 at 15:18
  • https://stackoverflow.com/questions/6236078/how-to-clear-the-cache-of-nginx – Siva Sep 12 '17 at 13:46

1 Answers1

-1

You can update your javascript file with adding the latest version with your file name, which is something like this.

<script src="yourfile.js?v12" > </script>

Here is the ?v12 the version of file you can add.

Every time you edit the javascript file, you can update it like ?v13, ?v14, ?v15 so on.

  • <script src="yourfile.js?v13" > </script>
  • <script src="yourfile.js?v14" > </script>
  • <script src="yourfile.js?v13" > </script>

That's how your javascript is not cached in browser.

Suman Bogati
  • 6,289
  • 1
  • 23
  • 34
  • There must be an alternative to this rather than doing versioning? – tjhack Feb 07 '14 at 15:41
  • @tjhack Yes, use js merging. Some applications support this and will generate a unique filename based on the content of the merge result. Overkill for this specific issue but it may benefit your site in more areas is to use Google's pagespeed module. –  Feb 08 '14 at 10:08