Skip to content

Instantly share code, notes, and snippets.

@bastos
Created June 11, 2009 14:51
Show Gist options
  • Save bastos/127946 to your computer and use it in GitHub Desktop.
Save bastos/127946 to your computer and use it in GitHub Desktop.
#!/usr/bin/ruby
require 'rubygems'
require 'memcache'
require 'benchmark'
MEMCACHE_OPTIONS = {
:c_threshold => 10_000,
:compression => true,
:debug => false,
:namespace => "bench:",
:readonly => false,
:urlencode => false,
:multithread => true
}
CACHE = MemCache.new ['0.0.0.0:11211'], MEMCACHE_OPTIONS
Benchmark.bm do |b|
b.report("Memcached access") do
10000.times do
CACHE.set "#{rand(1000)}-#{rand(1000)}-#{rand(1000)}", "010010" * rand(1000)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment