bminer / node-static-asset

Static asset manager for Node.JS and Express
MIT License
48 stars 13 forks source link

When cacheOn is not on, crc will get run with every call to assetFingerPrint regardless of file mtime #5

Closed brian-pantano closed 11 years ago

brian-pantano commented 11 years ago

You're not doing anything with mtime. I think you should either eliminate mtime from the code or use it to check if a file has been changed, and only recompute the crc then.

Also I think https://github.com/bminer/node-static-asset/blob/master/lib/cache-strategies/default.js#L19 should be mtime instead of lastModified (and the line below), but that won't fix this problem.

https://gist.github.com/brian-pantano/6068560 is what I do

bminer commented 11 years ago

I'm not a huge fan of mtime, actually. Etags seem to be much better for detecting file changes. The mtime stuff should probably be eliminated -- I'll agree. Sometimes it might be appropriate to use, though, which is why I left that stuff in there.

For example, some people might want to use a "cache strategy" based solely on mtime, not etag. node-static-asset gives the flexibility to do whatever you want.

Closing this issue for now, but please feel free to post back here.