added caching to the Blah.interesting methods

This commit is contained in:
Skud
2013-08-14 11:06:10 +10:00
parent 533529fa08
commit 46aa6ec758
4 changed files with 4 additions and 0 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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