Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support caching with Etags #93

Open
timurvafin opened this issue Jul 25, 2014 · 4 comments
Open

Support caching with Etags #93

timurvafin opened this issue Jul 25, 2014 · 4 comments

Comments

@timurvafin
Copy link
Member

No description provided.

@VladimirMikhailov
Copy link

AFAIK, Rails provides caching with etag by default:

  • Rack::ETag

and from http://guides.rubyonrails.org/caching_with_rails.html from 3 Conditional GET support:

Instead of an options hash, you can also simply pass in a model, Rails will use the updated_at and cache_key methods for setting last_modified and etag:

curl "http://localhost:5000/v1/posts.json" -X GET -v
< HTTP/1.1 200 OK
< X-Frame-Options: SAMEORIGIN
< X-XSS-Protection: 1; mode=block
< X-Content-Type-Options: nosniff
< X-UA-Compatible: chrome=1
< Content-Type: application/json; charset=utf-8
< ETag: "7b164b7b93707001116f3c29addb7922"
< Cache-Control: max-age=0, private, must-revalidaten

@timurvafin
Copy link
Member Author

@VladimirMikhailov we need to lear how to use stale? and fresh_when.

  • single resource: resource.updated_at
  • collection of resources: collection.max(:updated_at)

@maratnasyrov
Copy link
Contributor

Probably we could backport solution from DS cc @antongudkov @nickolayabdrafikov

@timurvafin timurvafin removed this from the API Format milestone Aug 6, 2015
@daniilsunyaev
Copy link
Contributor

@timurvafin could you please describe what is an issue here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants