On Thu, 1 Sep 2011, Raymond Wang wrote:
that is, given the two url of "www.a.com/sale/someFunction.js" and "www.a.com/sale/someFunction.js", and the javascript (someFunction.js) files have the same content. with squid, can I "cut" the part before "someFunction.js" when the url is given to generate cached object's key?
How do those two URLs differ? Did you mean to do something else in your example?
If you meant to change the path to the file in the second URL, which is what the rest of your question implies: there is no guarantee that someFunction.js actually has the same content at different URLs, so simply dropping the path part of the URL to get just the filename is not justified.
The only reliable way to do this would be to generate a MD5 or SHA1 hash of the file's content, and make the cache a mapping of pointers from URLs to unique content as well as having a cache of the content hashes. That's probably a fairly major change.
-- John Hardin KA7OHZ http://www.impsec.org/~jhardin/ jhardin@xxxxxxxxxx FALaholic #11174 pgpk -a jhardin@xxxxxxxxxx key: 0xB8732E79 -- 2D8C 34F4 6411 F507 136C AF76 D822 E6E6 B873 2E79 ----------------------------------------------------------------------- Politicians never accuse you of "greed" for wanting other people's money, only for wanting to keep your own money. -- Joseph Sobran ----------------------------------------------------------------------- 265 days since the first successful private orbital launch (SpaceX)