コード例 #1
0
    def testSingleBatch(self):
        mc = MemcacheConnection((MEMCACHE_IP, 11211))
        #batch = mc.batch()
        #batch.set('bset_1', 10)
        #batch.set('bset_2', 20)
        #batch.get('bset_1')
        #batch.get('bset_2')
        #result = batch.execute()
        #print result.receive()
        #print result.receive()
        #print result.receive()
        #print result.receive()

        N = 400
        B = 400

        with unittest.timer() as tmr:
            for i in range(N):
                batch = mc.batch()
                for j in range(B):
                    batch.set('test2', 'hello world!')
                for _ in batch.execute(
                ):  #TODO why do we need to read out results?
                    pass
        print 'single server batch set keys/sec', tmr.sec(B * N)
コード例 #2
0
ファイル: testmemcache.py プロジェクト: JoyTeam/concurrence
 def testExtraSingle(self):
     """test stuff that only makes sense on a single server connection"""
     mc = MemcacheConnection((MEMCACHE_IP, 11212))
     res1, v1 = mc.version()
     res2, v2 = mc.version()
     self.assertEquals(MemcacheResult.OK, res1)
     self.assertEquals(MemcacheResult.OK, res2)
     self.assertEquals(str, type(v1))
     self.assertEquals(str, type(v2))
     self.assertTrue(len(v1) > 1)
     self.assertEquals(v1, v2)
コード例 #3
0
 def testExtraSingle(self):
     """test stuff that only makes sense on a single server connection"""
     mc = MemcacheConnection((MEMCACHE_IP, 11211))
     res1, v1 = mc.version()
     res2, v2 = mc.version()
     self.assertEquals(MemcacheResult.OK, res1)
     self.assertEquals(MemcacheResult.OK, res2)
     self.assertEquals(str, type(v1))
     self.assertEquals(str, type(v2))
     self.assertTrue(len(v1) > 1)
     self.assertEquals(v1, v2)
コード例 #4
0
ファイル: testmemcache.py プロジェクト: JoyTeam/concurrence
    def testSingleBatch(self):
        mc = MemcacheConnection((MEMCACHE_IP, 11212))
        #batch = mc.batch()
        #batch.set('bset_1', 10)
        #batch.set('bset_2', 20)
        #batch.get('bset_1')
        #batch.get('bset_2')
        #result = batch.execute()
        #print result.receive()
        #print result.receive()
        #print result.receive()
        #print result.receive()

        N = 400
        B = 400

        with unittest.timer() as tmr:
            for i in range(N):
                batch = mc.batch()
                for j in range(B):
                    batch.set('test2', 'hello world!')
                for _ in batch.execute(): #TODO why do we need to read out results?
                    pass
        print 'single server batch set keys/sec', tmr.sec(B * N)
コード例 #5
0
 def testBasicSingle(self):
     mc = MemcacheConnection((MEMCACHE_IP, 11211))
     self.sharedTestBasic(mc)