Update fetch_groups_service.rb redis
This commit is contained in:
parent
3344afbb3d
commit
8a3ed8d921
|
@ -4,13 +4,19 @@ class FetchGroupsService < BaseService
|
||||||
def call(type)
|
def call(type)
|
||||||
|
|
||||||
if type == "featured"
|
if type == "featured"
|
||||||
body = Redis.current.get("groups:featuredgroups")
|
body = Redis.current.with do |conn|
|
||||||
|
conn.get("groups:featuredgroups")
|
||||||
|
end
|
||||||
|
|
||||||
if body.nil? || !body || body.empty?
|
if body.nil? || !body || body.empty?
|
||||||
@groupIds = Group.where(is_featured: true, is_archived: false).limit(150).all.pluck(:id)
|
@groupIds = Group.where(is_featured: true, is_archived: false).limit(150).all.pluck(:id)
|
||||||
|
|
||||||
Redis.current.set("groups:featuredgroups", @groupIds.join(","))
|
Redis.current.with do |conn|
|
||||||
Redis.current.expire("groups:featuredgroups", 6.hours.seconds)
|
conn.set("groups:featuredgroups", @groupIds.join(","))
|
||||||
|
end
|
||||||
|
Redis.current.with do |conn|
|
||||||
|
conn.expire("groups:featuredgroups", 6.hours.seconds)
|
||||||
|
end
|
||||||
|
|
||||||
@groupIds
|
@groupIds
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue