rails caching
This commit is contained in:
parent
e8f0a0b505
commit
6251821767
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue