mwrock / RequestReduce

Instantly makes your .net website faster by reducing the number and size of requests with almost no effort.
www.requestreduce.org
Apache License 2.0
228 stars 49 forks source link

RequestReduce files reuse file names - there is no client cache busting #237

Closed justengland closed 11 years ago

justengland commented 11 years ago

When I redeploy my application I need a way to bust the browsers cache.

Replication Steps:

  1. Find a page that uses RequestReduce to join javascript files. Not the javascript file name. example -
  2. Flush all content from the dashboard
  3. Refresh page until RequestReduce kicks in notice the generated filename is the exact same, thus the clients browser will not refresh.
mwrock commented 11 years ago

The name that RequestReduce generates is based on the hash of not only the file names combined but also their contents. So if the actual javascript changes, the file name should change. Are you finding that the name stays the same for optimized files even when their script changes?

justengland commented 11 years ago

I am not absolutely positive, I did not understand your hashing algorithm when I filed the bug.

When I noticed the issue, I made were pretty small js change, and I had to refresh browser cache and flush all content from the dashboard to correct the issue.

Any chance you are hashing on file length not file content?

Go ahead and close the issue, I will see if I can replicate it again. Thanks for the quick reply.

justengland commented 11 years ago

I am using the sql content store, I had multiple servers with different urls, pointing at the same data source, this was causing confusion, when I started pointing my environments to separate tables things were better.

I have to flush the sql store, when I do a deployment to reduce the risk of caching the files.

justengland commented 11 years ago

I was able to fix this issue by using the Api, it would be nice it was built in, you could use the assembly version number.

        RequestReduce.Api.Registry.UrlTransformer =
            (context, x, y) => y.Replace(
                "RequestReduceContent",
                "RequestReduceContent/" + BuildNumber);