Object
# File lib/moneta/couch.rb, line 12 def initialize(options = {}) @db = ::CouchRest.database!(options[:db]) unless options[:skip_expires] @expiration = Moneta::Couch.new(:db => "#{options[:db]}_expiration", :skip_expires => true) self.extend(StringExpires) end end
# File lib/moneta/couch.rb, line 28 def [](key) @db.get(key)["data"] rescue RestClient::ResourceNotFound nil end
# File lib/moneta/couch.rb, line 34 def []=(key, value) @db.save_doc("_id" => key, :data => value) rescue RestClient::RequestFailed self[key] end
# File lib/moneta/couch.rb, line 40 def delete(key) value = @db.get(key) @db.delete_doc({"_id" => value["_id"], "_rev" => value["_rev"]}) if value value["data"] rescue RestClient::ResourceNotFound nil end
# File lib/moneta/couch.rb, line 59 def delete_store @db.delete! end
# File lib/moneta/couch.rb, line 20 def key?(key) !self[key].nil? rescue RestClient::ResourceNotFound false end
Generated with the Darkfish Rdoc Generator 2.