Module: Couchbase::Operations::Fetch
- Defined in:
- lib/couchbase/operations/fetch.rb
Instance Method Summary collapse
Instance Method Details
#fetch(key, set_options = {}, &block) ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/couchbase/operations/fetch.rb', line 23 def fetch(key, = {}, &block) fail ArgumentError 'Must pass a block to #fetch' unless block_given? get(key, quiet: false) rescue Couchbase::Error::NotFound yield(block).tap {|value| set(key, value, ) } end |