T
T
Turtle_Onni2016-05-25 10:41:50
Angular
Turtle_Onni, 2016-05-25 10:41:50

How can I implement clearing the cache at the request of the developer?

Hello!
As everyone knows, in the process of developing a web application, there are often changes on the page that are not immediately displayed in the browser due to the cache. I need to implement the process of clearing the cache without the participation of the client. I'm not asking me to give a ready-made solution, share a link where to read about it?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
G
Gasoid, 2016-05-25
@Gasoid

just automatically change the file name or add a version or timestamp, then each time for the browser it will be different files, for example:

<link href='style.css?v92' />
<script src='main.js?20160523'></script>

R
rakro, 2016-05-25
@rakro

When changing in the js file, you need to change the name of the assembly file. The tools depend on the build process you are using. for gulp like gulp-manifest.

V
Vladimir Golosay, 2016-05-25
@golosay

If we are talking about js caching, then, as mentioned earlier, it is necessary to add versioning of files when deploying to production.
If you want to force the update of the Angular templates, then there is a command for this.
You can write it when you start the app:

app.run(['$templateCache', function ( $templateCache ) {
    $templateCache.removeAll(); }]);

M
Mikhail Osher, 2016-05-25
@miraage

1) correct nginx configuration for static files
2) fingerprint in the file name during deployment

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question