Skip to content
This repository has been archived by the owner on Jan 29, 2023. It is now read-only.

Commit

Permalink
Merge branch '1.9.2fixes' of http://github.com/Asquera/kestrel-client
Browse files Browse the repository at this point in the history
…into Asquera-1.9.2fixes
  • Loading branch information
freels committed Oct 8, 2010
2 parents 28eb378 + 373ec6c commit 289eace
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 8 deletions.
4 changes: 2 additions & 2 deletions lib/kestrel/client/stats_helper.rb
Expand Up @@ -69,9 +69,9 @@ def merge_stats(all_stats)

def deserialize_stat_value(value)
case value
when /^\d+\.\d+$/:
when /^\d+\.\d+$/
value.to_f
when /^\d+$/:
when /^\d+$/
value.to_i
else
value
Expand Down
20 changes: 15 additions & 5 deletions lib/kestrel/client/unmarshal.rb
Expand Up @@ -11,11 +11,21 @@ def get(key, opts = {})
response
end
end

def is_marshaled?(object)
object.to_s[0] == Marshal::MAJOR_VERSION && object.to_s[1] == Marshal::MINOR_VERSION
rescue Exception
false

if RUBY_VERSION.respond_to?(:getbyte)
def is_marshaled?(object)
o = object.to_s
o.getbyte(0) == Marshal::MAJOR_VERSION && o.getbyte(1) == Marshal::MINOR_VERSION
rescue Exception
false
end
else
def is_marshaled?(object)
o = object.to_s
o[0] == Marshal::MAJOR_VERSION && o[1] == Marshal::MINOR_VERSION
rescue Exception
false
end
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/kestrel_benchmark.rb
Expand Up @@ -20,7 +20,7 @@
x.report("set:") { for i in 1..times; @kestrel.set(@queue, @value); end }
x.report("get:") { for i in 1..times; @kestrel.get(@queue); end }
x.report("set (raw):") { for i in 1..times; @kestrel.set(@queue, @raw_value, 0, true); end }
x.report("get (raw):") { for i in 1..times; @kestrel.get(@queue, true); end }
x.report("get (raw):") { for i in 1..times; @kestrel.get(@queue, :raw => true); end }
end
end
end

0 comments on commit 289eace

Please sign in to comment.