Sha256: 086336ef7376480c895f59385c0dcadbc9a89976f1b017edb4182b0ae4e5f1cb

Contents?: true

Size: 373 Bytes

Versions: 40

Compression:

Stored size: 373 Bytes

Contents

# frozen_string_literal: true

module Motor
  module Resources
    module CustomSqlColumnsCache
      CACHE_STORE = ActiveSupport::Cache::MemoryStore.new(size: 5.megabytes)

      module_function

      def call(sql)
        CACHE_STORE.fetch(sql.hash) do
          Queries::RunQuery.call(Query.new(sql_body: sql), limit: 0).columns
        end
      end
    end
  end
end

Version data entries

40 entries across 40 versions & 1 rubygems

Version Path
motor-admin-0.2.24 lib/motor/resources/custom_sql_columns_cache.rb
motor-admin-0.2.23 lib/motor/resources/custom_sql_columns_cache.rb
motor-admin-0.2.22 lib/motor/resources/custom_sql_columns_cache.rb
motor-admin-0.2.21 lib/motor/resources/custom_sql_columns_cache.rb
motor-admin-0.2.20 lib/motor/resources/custom_sql_columns_cache.rb
motor-admin-0.2.19 lib/motor/resources/custom_sql_columns_cache.rb
motor-admin-0.2.18 lib/motor/resources/custom_sql_columns_cache.rb
motor-admin-0.2.17 lib/motor/resources/custom_sql_columns_cache.rb
motor-admin-0.2.16 lib/motor/resources/custom_sql_columns_cache.rb
motor-admin-0.2.15 lib/motor/resources/custom_sql_columns_cache.rb
motor-admin-0.2.14 lib/motor/resources/custom_sql_columns_cache.rb
motor-admin-0.2.13 lib/motor/resources/custom_sql_columns_cache.rb
motor-admin-0.2.12 lib/motor/resources/custom_sql_columns_cache.rb
motor-admin-0.2.11 lib/motor/resources/custom_sql_columns_cache.rb
motor-admin-0.2.10 lib/motor/resources/custom_sql_columns_cache.rb
motor-admin-0.2.9 lib/motor/resources/custom_sql_columns_cache.rb
motor-admin-0.2.8 lib/motor/resources/custom_sql_columns_cache.rb
motor-admin-0.2.7 lib/motor/resources/custom_sql_columns_cache.rb
motor-admin-0.2.6 lib/motor/resources/custom_sql_columns_cache.rb
motor-admin-0.2.5 lib/motor/resources/custom_sql_columns_cache.rb