bin 0.6 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/bin/store.rb +2 -2
- data/lib/bin/version.rb +1 -1
- data/spec/bin/store_spec.rb +1 -1
- metadata +2 -1
data/lib/bin/store.rb
CHANGED
@@ -15,7 +15,7 @@ module Bin
|
|
15
15
|
super do
|
16
16
|
expires = Time.now.utc + ((options && options[:expires_in]) || expires_in)
|
17
17
|
raw = !!options[:raw]
|
18
|
-
value = raw ? value : Marshal.dump(value)
|
18
|
+
value = raw ? value : BSON::Binary.new(Marshal.dump(value))
|
19
19
|
doc = {:_id => key, :value => value, :expires_at => expires, :raw => raw}
|
20
20
|
collection.save(doc)
|
21
21
|
end
|
@@ -24,7 +24,7 @@ module Bin
|
|
24
24
|
def read(key, options=nil)
|
25
25
|
super do
|
26
26
|
if doc = collection.find_one(:_id => key, :expires_at => {'$gt' => Time.now.utc})
|
27
|
-
doc['raw'] ? doc['value'] : Marshal.load(doc['value'])
|
27
|
+
doc['raw'] ? doc['value'] : Marshal.load(doc['value'].to_s)
|
28
28
|
end
|
29
29
|
end
|
30
30
|
end
|
data/lib/bin/version.rb
CHANGED
data/spec/bin/store_spec.rb
CHANGED