class Ezframe::DB::Cache

Public Class Methods

[](table) click to toggle source
# File lib/ezframe/database.rb, line 165
def [](table)
  @store ||= {}
  dataset = DB.dataset(table.to_sym)
  # EzLog.debug("DB::Cache: #{table}")
  unless @store[table.to_sym]
    data_a = dataset.where(deleted_at: nil).all
    h = {}
    data_a.each {|data| h[data[:id]] = data }
    @store[table.to_sym] = h
  end
  # EzLog.debug(@store[table.to_sym])
  return @store[table.to_sym]
end