We have one caching issues on live site. Actually we keep JS/CSS files in sitecore media library so after every prod deployment when we publish updates JS file we have to press Ctrl+F5 to load latest JS file updates. This is fine for Developers but not for visitors and we can't instruct every visitors to press Ctrl+F5.
<script src="/-/media/common/js/productlisting.js"></script>
To mitigate this issue we are planning to add time-stamp as a query string in src attribute in <script>
element as described in below URL
https://css-tricks.com/can-we-prevent-css-caching/
and this looks like need modification in sitecore media pipelines. Any idea how can we do this.
OR
Any other suggestion much appreciated
Thanks
UPDATE 07/17/2017
Below Patch works for me
<mediaProvider>
<patch:attribute name="type">MyProject.Pipelines.CacheBustingMediaProvider, MyProject</patch:attribute>
</mediaProvider>
I see very strange behavior see screenshot. While debugging I found code between line no. 16 and 34 is not getting executed. You can see when I tried to set debug at line no. 14 it throw exception. finally debug point come to line no. 12 and then directly goes to line no. 36 and goes out. Any idea on this.