Module: Cash::Index::Commands

Included in:
Cash::Index
Defined in:
lib/cash/index.rb

Instance Method Summary collapse

Instance Method Details

#add(object) ⇒ Object



24
25
26
27
28
# File 'lib/cash/index.rb', line 24

def add(object)
  clone = object.shallow_clone
  _, new_attribute_value_pairs = old_and_new_attribute_value_pairs(object)
  add_to_index_with_minimal_network_operations(new_attribute_value_pairs, clone)
end

#delete(object) ⇒ Object



41
42
43
44
45
# File 'lib/cash/index.rb', line 41

def delete(object)
  old_attribute_value_pairs, _ = old_and_new_attribute_value_pairs(object)
  key = cache_key(old_attribute_value_pairs)
  expire(key)
end

#remove(object) ⇒ Object



36
37
38
39
# File 'lib/cash/index.rb', line 36

def remove(object)
  old_attribute_value_pairs, _ = old_and_new_attribute_value_pairs(object)
  remove_from_index_with_minimal_network_operations(old_attribute_value_pairs, object)
end

#update(object) ⇒ Object



30
31
32
33
34
# File 'lib/cash/index.rb', line 30

def update(object)
  clone = object.shallow_clone
  old_attribute_value_pairs, new_attribute_value_pairs = old_and_new_attribute_value_pairs(object)
  update_index_with_minimal_network_operations(old_attribute_value_pairs, new_attribute_value_pairs, clone)
end