Sha256: a6d87fa504b24408b9426278769a96780d4e52c1dfccc3850d7abcd2f8fdaed1

Contents?: true

Size: 642 Bytes

Versions: 2

Compression:

Stored size: 642 Bytes

Contents

require 'rubygems'
$LOAD_PATH.unshift File.dirname(__FILE__) + '/../lib'
require 'fastcache'
require 'memcache'
require 'benchmark'

NODE = ['localhost:11211']

n = 1000
Benchmark.bm(30) do |x|
  x.report 'basic operations - memcache-client' do
    conn = MemCache.new(*NODE)
    n.times do
      conn.get('f')
      conn.set('f', '42')
      conn.get('f')
      conn.delete('f')
    end
    conn.reset
  end
  x.report 'basic operations - fastcache' do
    conn = FastCache.connect(NODE)
    n.times do
      conn.get('f')
      conn.set('f', '42')
      conn.get('f')
      conn.delete('f')
    end
    conn.close_all_connections
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
binary42-fastcache-0.2 benchmark/basic.rb
binary42-fastcache-0.3 benchmark/basic.rb