Vyacheslav Loginov
Vyacheslav Loginov

Reputation: 3216

Rails api cache

I want to caching api responses like

sitename.com/posts.json

for example for 5 minutes, where I must configure Rails and maybe what external tools I must use

Upvotes: 0

Views: 804

Answers (1)

riffraff
riffraff

Reputation: 2447

just add

 caches_page :posts, :expires_in => 5.minutes

it's explained decently on http://guides.rubyonrails.org/caching_with_rails.html#page-caching

Notice that expires_in only works with memcached as the cache store, AFAIK.

Upvotes: 2

Related Questions