lib/bin/store.rb in honkster-bin-0.6.3.4 vs lib/bin/store.rb in honkster-bin-0.6.3.5
- old
+ new
@@ -18,18 +18,16 @@
raw = !!options[:raw]
value = raw ? value : BSON::Binary.new(Marshal.dump(value))
doc = {:_id => key, :value => value, :expires_at => expires, :raw => raw}
collection.save(doc)
end
- alias_method :write_entry, :write
def read_entry(key, options=nil)
if doc = collection.find_one(:_id => key.to_s, :expires_at => {'$gt' => Time.now.utc})
value = doc['raw'] ? doc['value'] : Marshal.load(doc['value'].to_s)
value.is_a?(ActiveSupport::Cache::Entry) ? value : ActiveSupport::Cache::Entry.new(value, options)
end
end
- alias_method :read_entry, :read
def delete(key, options=nil)
super do
collection.remove(:_id => key.to_s)
end
\ No newline at end of file