Method: Dis::Model::Data#expire

Defined in:
lib/dis/model/data.rb

#expire(hash) ⇒ Object

Expires a data object from the storage if it’s no longer being used by existing records. This is triggered from callbacks on the record whenever they are changed or destroyed.



52
53
54
55
56
57
58
# File 'lib/dis/model/data.rb', line 52

def expire(hash)
  unless @record.class.where(
    @record.class.dis_attributes[:content_hash] => hash
  ).any?
    Dis::Storage.delete(storage_type, hash)
  end
end