Skip to content

Instantly share code, notes, and snippets.

@lukemelia
Created March 23, 2009 15:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lukemelia/83579 to your computer and use it in GitHub Desktop.
Save lukemelia/83579 to your computer and use it in GitHub Desktop.
m_local = MemCache.new('127.0.0.1:11211')
=> <MemCache: 1 servers, ns: nil, ro: false>
>> m_remote = MemCache.new('ey04-s00298:11211')
=> <MemCache: 1 servers, ns: nil, ro: false>
>>
?> first_id = Sport.first.id
=> 1
>> key = "Sport:#{first_id}"
=> "Sport:1"
>> m_local.set key, Sport.find(first_id) # prime cache
=> "STORED\r\n"
>> m_remote.set key, Sport.find(first_id)
=> "STORED\r\n"
>>
?> Benchmark.bm(20) do |b|
?> b.report "local" do
?> x.times do
?> m_local.get key
>> end
>> end
>>
?> b.report "remote" do
?> x.times do
?> m_remote.get key
>> end
>> end
>> end
user system total real
local 12.990000 0.400000 13.390000 ( 22.484441)
remote 12.970000 0.390000 13.360000 ( 24.380477)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment