Varnish caching for artist data and lastfm suggest
This commit is contained in:
parent
98f4311527
commit
78484b8fd3
|
@ -64,4 +64,4 @@ $('#search-form').live 'submit', ->
|
||||||
false
|
false
|
||||||
$('.data.artist').live 'click', ->
|
$('.data.artist').live 'click', ->
|
||||||
_search.loadArtistData $(this).html()
|
_search.loadArtistData $(this).html()
|
||||||
false
|
false
|
||||||
|
|
|
@ -32,6 +32,7 @@ class ArtistController < ApplicationController
|
||||||
return render json: { status: 'fail', html: render_compact_partial(:fail) }
|
return render json: { status: 'fail', html: render_compact_partial(:fail) }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
response.headers['Cache-Control'] = 'public, max-age='+1.week.seconds.to_s
|
||||||
render json: {
|
render json: {
|
||||||
status: @artist.status_str,
|
status: @artist.status_str,
|
||||||
artist: @artist,
|
artist: @artist,
|
||||||
|
|
|
@ -86,6 +86,8 @@ class LastFmController < ApplicationController
|
||||||
autocomplete["response"]["docs"].each do |doc|
|
autocomplete["response"]["docs"].each do |doc|
|
||||||
suggestions << doc["artist"] unless suggestions.include?(doc["artist"]) or doc["artist"].nil? or doc['restype'] != 6
|
suggestions << doc["artist"] unless suggestions.include?(doc["artist"]) or doc["artist"].nil? or doc['restype'] != 6
|
||||||
end
|
end
|
||||||
|
|
||||||
|
response.headers['Cache-Control'] = 'public, max-age='+1.week.seconds.to_s
|
||||||
render :json => {
|
render :json => {
|
||||||
:query => params[:query],
|
:query => params[:query],
|
||||||
:suggestions => suggestions.take(5)
|
:suggestions => suggestions.take(5)
|
||||||
|
|
Loading…
Reference in New Issue