Module: Cash::Index::Commands

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

Instance Method Summary collapse

Instance Method Details

#add(object) ⇒ Object



22
23
24
25
26
# File 'lib/cash/index.rb', line 22

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



39
40
41
42
43
# File 'lib/cash/index.rb', line 39

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



34
35
36
37
# File 'lib/cash/index.rb', line 34

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



28
29
30
31
32
# File 'lib/cash/index.rb', line 28

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