mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-03-30 04:35:28 -04:00
added caching to the Blah.interesting methods
This commit is contained in:
@@ -95,6 +95,7 @@ class Crop < ActiveRecord::Base
|
||||
interesting_crops.push(c)
|
||||
end
|
||||
|
||||
Rails.cache.fetch("interesting_crops", :expires_in => 1.day)
|
||||
return interesting_crops
|
||||
end
|
||||
|
||||
|
||||
@@ -188,6 +188,7 @@ class Member < ActiveRecord::Base
|
||||
next unless m.plantings.present?
|
||||
interesting_members.push(m)
|
||||
end
|
||||
Rails.cache.fetch('interesting_members', :expires_in => 1.day)
|
||||
return interesting_members
|
||||
end
|
||||
|
||||
|
||||
@@ -83,6 +83,7 @@ class Planting < ActiveRecord::Base
|
||||
interesting_plantings.push(p)
|
||||
end
|
||||
|
||||
Rails.cache.fetch("interesting_plantings", :expires_in => 3.hours)
|
||||
return interesting_plantings
|
||||
end
|
||||
end
|
||||
|
||||
@@ -41,6 +41,7 @@ class Seed < ActiveRecord::Base
|
||||
interesting_seeds.push(s)
|
||||
end
|
||||
|
||||
Rails.cache.fetch('interesting_seeds', :expires_in => 6.hours)
|
||||
return interesting_seeds
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user