Updated GabTrendsController feed redis key
• Updated: - GabTrendsController feed redis key
This commit is contained in:
parent
ad4c6df155
commit
7087926a9c
|
@ -8,7 +8,7 @@ class Api::V1::GabTrendsController < Api::BaseController
|
|||
def index
|
||||
type = params[:type]
|
||||
if type == 'feed'
|
||||
body = Redis.current.get("gabtrends")
|
||||
body = Redis.current.get("gabtrends:feed")
|
||||
|
||||
if body.nil?
|
||||
uri = URI("https://trends.gab.com/trend-feed/json")
|
||||
|
@ -17,8 +17,8 @@ class Api::V1::GabTrendsController < Api::BaseController
|
|||
res = Net::HTTP.get_response(uri)
|
||||
if res.is_a?(Net::HTTPSuccess)
|
||||
body = res.body
|
||||
Redis.current.set("gabtrends", res.body)
|
||||
Redis.current.expire("gabtrends", 1.hour.seconds)
|
||||
Redis.current.set("gabtrends:feed", res.body)
|
||||
Redis.current.expire("gabtrends:feed", 1.hour.seconds)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue