{"action":"closed","issue":{"url":"https://api.github.com/repos/pelias/api/issues/23","labels_url":"https://api.github.com/repos/pelias/api/issues/23/labels{/name}","comments_url":"https://api.github.com/repos/pelias/api/issues/23/comments","events_url":"https://api.github.com/repos/pelias/api/issues/23/events","html_url":"https://github.com/pelias/api/issues/23","id":44301212,"number":23,"title":"caching strategy / etags","user":{"login":"missinglink","id":738069,"avatar_url":"https://avatars.githubusercontent.com/u/738069?v=3","gravatar_id":"","url":"https://api.github.com/users/missinglink","html_url":"https://github.com/missinglink","followers_url":"https://api.github.com/users/missinglink/followers","following_url":"https://api.github.com/users/missinglink/following{/other_user}","gists_url":"https://api.github.com/users/missinglink/gists{/gist_id}","starred_url":"https://api.github.com/users/missinglink/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/missinglink/subscriptions","organizations_url":"https://api.github.com/users/missinglink/orgs","repos_url":"https://api.github.com/users/missinglink/repos","events_url":"https://api.github.com/users/missinglink/events{/privacy}","received_events_url":"https://api.github.com/users/missinglink/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2014-09-29T14:42:56Z","updated_at":"2015-10-14T21:33:44Z","closed_at":"2015-10-14T21:33:43Z","body":"The API etags are messed up because of the `date` property in the body changing all the time.\r\n\r\nThe etag should be the same for the same content.\r\n\r\nA few fixes come to mind:\r\n1) move date to header, may be hard for ajax consumers to deal with\r\n2) remove date, will be hard for frontends to handle stale `/suggest` requests\r\n3) manually compute the etag then add the date\r\n4) something else\r\n\r\nPersonally; I would prefer to completely drop etags in favour of `max-age` headers as they are more performant due to making far less network requests and they are well suited for content which doesn't change often.\r\n\r\nWith any solution there will be an issue with the `date` property; which exists to ensure that database & network congestion doesn't cause older requests to change the UI after a newer request has already been received and rendered.\r\n\r\nSome serious thought needs to go in to ideal cache control strategies; which account for near-side and far-side caching, mobile experience and typeahead UI.\r\n\r\nref: http://vadmyst.blogspot.de/2005/09/server-side-etag-vs-cache-control-max.html"}}