Method: Cash::Accessor::ClassMethods#add

Defined in:
lib/cash/accessor.rb

#add(key, value, options = {}) ⇒ Object



42
43
44
45
46
# File 'lib/cash/accessor.rb', line 42

def add(key, value, options = {})
  if repository.add(cache_key(key), value, options[:ttl] || cache_config.ttl, options[:raw]) == "NOT_STORED\r\n"
    yield if block_given?
  end
end