class FastCache::ModulusBucket def initialize(nodes) @nodes = nodes end def select(hash) count = @nodes.size count.times do |i| begin break yield(@nodes[(hash + i) % count]) rescue FastCache::Memcache::ProtocolError next end raise 'Unable to find suitable node to communicate with' end end end