module Dynamoid::IdentityMap

Public Class Methods

clear() click to toggle source
# File lib/dynamoid/identity_map.rb, line 5
def self.clear
  Dynamoid.included_models.each { |m| m.identity_map.clear }
end

Public Instance Methods

delete() click to toggle source
Calls superclass method
# File lib/dynamoid/identity_map.rb, line 76
def delete
  return super if self.class.identity_map_off?

  identity_map.delete(identity_map_key)
  super
end
identity_map() click to toggle source
# File lib/dynamoid/identity_map.rb, line 63
def identity_map
  self.class.identity_map
end
identity_map_key() click to toggle source
# File lib/dynamoid/identity_map.rb, line 84
def identity_map_key
  key = hash_key.to_s
  if self.class.range_key
    key += "::#{range_value}"
  end
  key
end
save(*args) click to toggle source
Calls superclass method
# File lib/dynamoid/identity_map.rb, line 67
def save(*args)
  return super if self.class.identity_map_off?

  if result = super
    identity_map[identity_map_key] = self
  end
  result
end