{"action":"created","issue":{"url":"https://api.github.com/repos/mozilla-services/cliquet/issues/401","labels_url":"https://api.github.com/repos/mozilla-services/cliquet/issues/401/labels{/name}","comments_url":"https://api.github.com/repos/mozilla-services/cliquet/issues/401/comments","events_url":"https://api.github.com/repos/mozilla-services/cliquet/issues/401/events","html_url":"https://github.com/mozilla-services/cliquet/issues/401","id":95662029,"number":401,"title":"Add cache headers","user":{"login":"tarekziade","id":250019,"avatar_url":"https://avatars.githubusercontent.com/u/250019?v=3","gravatar_id":"","url":"https://api.github.com/users/tarekziade","html_url":"https://github.com/tarekziade","followers_url":"https://api.github.com/users/tarekziade/followers","following_url":"https://api.github.com/users/tarekziade/following{/other_user}","gists_url":"https://api.github.com/users/tarekziade/gists{/gist_id}","starred_url":"https://api.github.com/users/tarekziade/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tarekziade/subscriptions","organizations_url":"https://api.github.com/users/tarekziade/orgs","repos_url":"https://api.github.com/users/tarekziade/repos","events_url":"https://api.github.com/users/tarekziade/events{/privacy}","received_events_url":"https://api.github.com/users/tarekziade/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/mozilla-services/cliquet/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-07-17T14:03:04Z","updated_at":"2015-08-31T12:43:51Z","closed_at":null,"body":"We will use Kinto behind a proxy cache for Go Faster on all GETs.\r\n\r\nIn order to do this we need to implement a few headers:  Expires & Cache-Control.\r\n\r\nWe're probably going to use Nginx as a cache server - since it's already our proxy. \r\n\r\nSo this link http://wiki.nginx.org/NginxHttpProxyModule#proxy_cache is a good reading to implement the cache headers. \r\n\r\nThis page is also cool to understand how to set up nginx as a proxy cache : https://serversforhackers.com/nginx-caching\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/mozilla-services/cliquet/issues/comments/136361204","html_url":"https://github.com/mozilla-services/cliquet/issues/401#issuecomment-136361204","issue_url":"https://api.github.com/repos/mozilla-services/cliquet/issues/401","id":136361204,"user":{"login":"ametaireau","id":67073,"avatar_url":"https://avatars.githubusercontent.com/u/67073?v=3","gravatar_id":"","url":"https://api.github.com/users/ametaireau","html_url":"https://github.com/ametaireau","followers_url":"https://api.github.com/users/ametaireau/followers","following_url":"https://api.github.com/users/ametaireau/following{/other_user}","gists_url":"https://api.github.com/users/ametaireau/gists{/gist_id}","starred_url":"https://api.github.com/users/ametaireau/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ametaireau/subscriptions","organizations_url":"https://api.github.com/users/ametaireau/orgs","repos_url":"https://api.github.com/users/ametaireau/repos","events_url":"https://api.github.com/users/ametaireau/events{/privacy}","received_events_url":"https://api.github.com/users/ametaireau/received_events","type":"User","site_admin":false},"created_at":"2015-08-31T12:43:51Z","updated_at":"2015-08-31T12:43:51Z","body":"Thanks for starting this discussion! In order to explicitly state the problem we are trying to solve, here is some more context:\r\n\r\nFor the go-faster project, a set of [kinto collections](http://kinto.readthedocs.org/en/latest/concepts.html#buckets-collections-and-records) will be used to publish updates to the User-Agents (Firefox instances) out in the wild.\r\n\r\nThis data is globally shared and all the client will only have read access to it. Rather than requesting the data to Kinto at each request, it might make sense to cache Kinto's response.\r\n\r\nThe clients, in order to retrieve the latest data, will issue a `GET /buckets/{bid}/collections/{cid}/records?_since={timestamp}` as described in the (polling for change section)[http://kinto.readthedocs.org/en/latest/api/synchronisation.html#polling-for-changes] of the docs.\r\n\r\nEach time the collection is updated, the cache should be invalidated, and eventually recreated. We could use the Kinto notification system in order to ping the caching layer.\r\n\r\nWith this in mind, I looked at the documents you pointed out Tarek (thanks!). I don't see any way to invalidate the cache in there, tough.\r\n\r\nBefore digging more in the details of caching, I think we should ensure a few things:\r\n\r\nDo we need to invalidate the cache just after a database update? If not, we might just wait for a specific period and let the cache expire, and the origin server being called again;\r\n\r\nIs NGINX the caching layer we will use in production? (hi @micheletto, @deanwilson)"}}