[MGNLUI-340] Images and assets should be cached on client until there is a new version of the asset Created: 05/Dec/12 Updated: 17/Jun/13 Resolved: 07/Jan/13 |
|
| Status: | Closed |
| Project: | Magnolia UI |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 5.0 |
| Type: | Bug | Priority: | Blocker |
| Reporter: | Christopher Zimmermann | Assignee: | Christopher Zimmermann |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||||||||||||||||||
| Template: |
|
||||||||||||||||||||||||||||||||
| Acceptance criteria: |
Empty
|
||||||||||||||||||||||||||||||||
| Task DoD: |
[ ]*
Doc/release notes changes? Comment present?
[ ]*
Downstream builds green?
[ ]*
Solution information and context easily available?
[ ]*
Tests
[ ]*
FixVersion filled and not yet released
[ ] 
Architecture Decision Record (ADR)
|
||||||||||||||||||||||||||||||||
| Bug DoR: |
[ ]*
Steps to reproduce, expected, and actual results filled
[ ]*
Affected version filled
|
||||||||||||||||||||||||||||||||
| Date of First Response: | |||||||||||||||||||||||||||||||||
| Description |
|
For M5 Alpha1 we are setting images headers to no cache so we always see the changes when images are edited (http://jira.magnolia-cms.com/browse/MGNLIMG-103) But this is bad for performance. First part of this ticket is to remove the no-cache header. Part of the solution may be in Imaging Module, but putting it in here for now.Move ticket if needed. |
| Comments |
| Comment by Christopher Zimmermann [ 03/Jan/13 ] |
|
To achieve this, the internets recommend changing the name of the file, rather then adding a query string. This technique is called "fingerprinting" because you give the file a unique name to match the content. Im opting to use the lastModified date for the fingerprint, though there are recommendations to use an md5 hash of the content so that the fingerprint really only changes when the data changes. This seems more complicated then is really necessary. |
| Comment by Christopher Zimmermann [ 03/Jan/13 ] |
|
Resources: http://www.stevesouders.com/blog/2008/08/23/revving-filenames-dont-use-querystring/ |
| Comment by Christopher Zimmermann [ 03/Jan/13 ] |
|
call addAssetCacheFingerprintToLink in getGeneratorImagePath. you can test that this works be cropping an asset in the assets app, then see that the thumbnail and preview are updated with the new image. (because of the updated url of the images.) |
| Comment by Federico Grilli [ 03/Jan/13 ] |
|
Reopened after review. One minor remark: in LinkUtilAsset it's maybe better to use http://commons.apache.org/lang/api-2.4/org/apache/commons/lang/time/FastDateFormat.html as a class level formatter (it is thread-safe) rather than instantiating each time java.text.SimpleDateFormat in addAssetCacheFingerprintToLink(..) which, iirc, has some performance issues. |
| Comment by Christopher Zimmermann [ 07/Jan/13 ] |
|
Applied formatting. |