module ActiveRedis::ConnectionExt::FindersLayer

Public Class Methods

included(base) click to toggle source
# File lib/active_redis/connection_ext/finders_layer.rb, line 6
def self.included(base)
  base.send :extend, ActiveRedis::Logs::QueryLogger
  base.loggable :run_query_analyzer
end

Public Instance Methods

fetch_keys(model) click to toggle source
# File lib/active_redis/connection_ext/finders_layer.rb, line 15
def fetch_keys(model)
  ActiveRedis.log.write "Calling ActiveRedis::ConnectionExt::FindersLayer::fetch_keys(#{model.name})"
  adapter.keys model.key_name
end
fetch_row(model, id) click to toggle source
# File lib/active_redis/connection_ext/finders_layer.rb, line 11
def fetch_row(model, id)
  fetch_where(model, id: id).first
end
fetch_where(model, params) click to toggle source
# File lib/active_redis/connection_ext/finders_layer.rb, line 20
def fetch_where(model, params)
  ActiveRedis.log.write "Calling ActiveRedis::ConnectionExt::FindersLayer::fetch_where(#{model.name}, #{params})"
  run_eval :where, [model.key_name], params.flatten
end
run_query_analyzer(model, params = ["", "", "", ""]) click to toggle source
# File lib/active_redis/connection_ext/finders_layer.rb, line 25
def run_query_analyzer(model, params = ["", "", "", ""])
  run_eval :query_analyzer, [model.key_name, Time.now.to_i], params
end