class User::UserMemory

Public Class Methods

new() click to toggle source
Calls superclass method Diva::Model::Memory.new
# File core/user.rb, line 151
def initialize
  super
  @idnames = {}             # idname => User
end

Public Instance Methods

findbyid(id, policy) click to toggle source
Calls superclass method Diva::Model::Memory#findbyid
# File core/user.rb, line 156
def findbyid(id, policy)
  result = super
  if !result and policy == Diva::DataSource::USE_ALL
    if id.is_a? Enumerable
      id.each_slice(100).map{|id_list|
        Service.primary.scan(:user_lookup, id: id_list.join(','.freeze)) || [] }.flatten
    else
      Service.primary.scan(:user_show, id: id) end
  else
    result end end
findbyidname(idname, policy) click to toggle source
# File core/user.rb, line 167
def findbyidname(idname, policy)
  if @idnames[idname.to_s]
    @idnames[idname.to_s]
  elsif policy == Diva::DataSource::USE_ALL
    Service.primary.scan(:user_show, screen_name: idname)
  end
end
store_datum(user) click to toggle source
Calls superclass method Diva::Model::Memory#store_datum
# File core/user.rb, line 175
def store_datum(user)
  @idnames[user.idname.to_s] = user
  super
end