Sha256: 82c27e1a6604a9a3d7c19b1fa2c8434aa05118b93673747c735753f031d44354
Contents?: true
Size: 1.27 KB
Versions: 1
Compression:
Stored size: 1.27 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 Memcached.servers = [] 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
astro-remcached-0.2.2 | spec/memcached_spec.rb |