Sha256: 6dec8062e36ed832f2aaf19bbdba2acbdcf99b1c5b15d9d5c6fa78ed467231c3
Contents?: true
Size: 1.24 KB
Versions: 2
Compression:
Stored size: 1.24 KB
Contents
$: << File.dirname(__FILE__) + '/../lib' require 'remcached' describe Memcached::Client do def run(&block) EM.run do Memcached.servers = %w(127.0.0.2 localhost:11212 localhost localhost) started = false EM::PeriodicTimer.new(0.1) do if !started && Memcached.usable? started = true block.call end end end end def stop EM.stop end context "when using multiple servers" do it "should not return the same hash for the succeeding key" do run do Memcached.hash_key('0').should_not == Memcached.hash_key('1') stop end end it "should not return the same client for the succeeding key" do run do # wait for 2nd client to be connected EM::Timer.new(0.1) do Memcached.client_for_key('0').should_not == Memcached.client_for_key('1') stop end end end it "should spread load (observe from outside :-)" do run do n = 10000 replies = 0 n.times do |i| Memcached.set(:key => "#{i % 100}", :value => rand(1 << 31).to_s) { replies += 1 stop if replies >= n } end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
astro-remcached-0.2.0 | spec/memcached_spec.rb |
astro-remcached-0.2.1 | spec/memcached_spec.rb |