rails caching
This commit is contained in:
parent
e8f0a0b505
commit
6251821767
|
@ -2,9 +2,11 @@ class TablesController < ApplicationController
|
||||||
|
|
||||||
AirtableSheets.each do |k,v|
|
AirtableSheets.each do |k,v|
|
||||||
define_method(k) do
|
define_method(k) do
|
||||||
::Rails.cache.fetch("cache/#{k}", expires_in: 30.seconds) do
|
records = ::Rails.cache.fetch("cache/#{k}", expires_in: 30.seconds) do
|
||||||
render json: v.all.to_json
|
v.all.to_json
|
||||||
end
|
end
|
||||||
|
|
||||||
|
render json: records
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue