1
0
Fork 0

Varnish caching for artist data and lastfm suggest

This commit is contained in:
Gregory Eremin 2011-11-24 14:14:06 +04:00
parent 98f4311527
commit 78484b8fd3
3 changed files with 4 additions and 1 deletions

View File

@ -32,6 +32,7 @@ class ArtistController < ApplicationController
return render json: { status: 'fail', html: render_compact_partial(:fail) }
end
response.headers['Cache-Control'] = 'public, max-age='+1.week.seconds.to_s
render json: {
status: @artist.status_str,
artist: @artist,

View File

@ -86,6 +86,8 @@ class LastFmController < ApplicationController
autocomplete["response"]["docs"].each do |doc|
suggestions << doc["artist"] unless suggestions.include?(doc["artist"]) or doc["artist"].nil? or doc['restype'] != 6
end
response.headers['Cache-Control'] = 'public, max-age='+1.week.seconds.to_s
render :json => {
:query => params[:query],
:suggestions => suggestions.take(5)