Exemple #1
0
    def test_ShardedConnection(self):

        hosts = ["%s:%s" % (redis_host, redis_port)]
        db = yield txredisapi.ShardedConnection(hosts, reconnect=False)
        try:
            yield db.pipeline()
            raise self.failureException("Expected sharding to disallow pipelining")
        except NotImplementedError, e:
            self.assertTrue("not supported" in str(e).lower())
Exemple #2
0
def main():
    # run two redis servers, one at port 6379 and another in 6380
    conn = yield redis.ShardedConnection(["localhost:6379", "localhost:6380"])
    print repr(conn)

    keys = ["test:%d" % x for x in xrange(100)]
    for k in keys:
        try:
            yield conn.set(k, "foobar")
        except:
            print 'ops'

    result = yield conn.mget(keys)
    print result

    # testing tags
    keys = ["test{lero}:%d" % x for x in xrange(100)]
    for k in keys:
        yield conn.set(k, "foobar")

    result = yield conn.mget(keys)
    print result

    yield conn.disconnect()
 def test_ShardedConnection(self):
     hosts = ["%s:%s" % (redis_host, redis_port)]
     db = yield redis.ShardedConnection(hosts, reconnect=False)
     self.assertEqual(isinstance(db, redis.ShardedConnectionHandler), True)
     yield db.disconnect()
Exemple #4
0
def main(wordlist):
    db = yield redis.ShardedConnection(("localhost:6379", "localhost:6380"))
    for k in wordlist:
        yield db.set(k, 1)

    reactor.stop()