Module: Moneta::Defaults
- Included in:
- Adapters::ActiveRecord, Adapters::BasicFile, Adapters::Cassandra, Adapters::Couch, Adapters::DataMapper, Adapters::File, Adapters::Fog, Adapters::LMC, Adapters::Memcache, Adapters::Memory, Adapters::MongoDB, Adapters::PStore, Adapters::Redis, Adapters::Riak, Adapters::SDBM, Adapters::TokyoCabinet, Adapters::Tyrant, Adapters::Xattr, Adapters::YAML
- Defined in:
- lib/moneta.rb
Instance Method Summary collapse
Instance Method Details
#[]=(key, value) ⇒ Object
12 13 14 |
# File 'lib/moneta.rb', line 12 def []=(key, value) store(key, value) end |
#fetch(key, value = nil) ⇒ Object
5 6 7 8 9 10 |
# File 'lib/moneta.rb', line 5 def fetch(key, value = nil, *) self[key] || begin value ||= block_given? ? yield(key) : default self[key] || value end end |