- HOW IT WORKS
- SEE ALSO
Mojolicious::Plugin::TagHelpers::NoCaching - Force images, styles, js reloading by the browser if they were modified on filesystem
If you ever come across this, this module will help you.
This plugin contains several helpers described below. All this helpers are alternatives for helpers with same name (but without _nc suffix) from Mojolicious::Plugin::TagHelpers. "_nc" suffix in helpers names means "no caching". Behaviour of this helpers are identical except that helpers from this module adds query parameter with file version for each file included with help of them. For now query parameter is modification time of the file. So we can guarantee that when file will be modified query parameter will be changed and file will be reloaded by the browser on next request. This works only for server local files included with absolute url ("http://host/file.css"), absolute path ("/file.css") or relative path ("file.css"). And they will become something like "http://host/file.css?nc=1384766621", "/file.css?nc=1384766621", "file.css"?nc=1384766621" respectively.
One important thing is that query parameter for modified file will be changed only after application reload, because modification time for included files will be cached to be more efficient. This shouldn't be big problem, because when you updating your app with new version you also changed your perl files and should reload application. Or if you are on development morbo server it will reload application for you.
Config for plugin accepts this options
Which query key should be used. Default is "nc".
Mojolicious::Plugin::TagHelpers::NoCaching implements the following helpers
Same as stylesheet, but will add query key and value to prevent caching
Same as image, but will add query key and value to prevent caching
Copyright Oleg G <email@example.com>.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.