rails caching

This commit is contained in:
Abhi Yerra 2017-10-10 21:17:01 +00:00
parent e8f0a0b505
commit 6251821767
1 changed files with 4 additions and 2 deletions

View File

@ -2,9 +2,11 @@ class TablesController < ApplicationController
AirtableSheets.each do |k,v|
define_method(k) do
::Rails.cache.fetch("cache/#{k}", expires_in: 30.seconds) do
render json: v.all.to_json
records = ::Rails.cache.fetch("cache/#{k}", expires_in: 30.seconds) do
v.all.to_json
end
render json: records
end
end
end