Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(3)  |  Call(3)  |  Derive(0)  |  Import(0)
Context manager for reserving a client from the pool.

If *block* is given and the pool is exhausted, the pool waits for
another thread to fill it before returning.

src/p/y/pylibmc-1.3.0/tests/test_pooling.py   pylibmc(Download)
    def test_simple(self):
        p = pylibmc.ClientPool(self.mc, 2)
        with p.reserve() as smc:
            ok_(smc)
            ok_(smc.set("a", 1))
            eq_(smc["a"], 1)
 
    def test_exhaust(self):
        p = pylibmc.ClientPool(self.mc, 2)
        with p.reserve() as smc1:
    def test_exhaust(self):
        p = pylibmc.ClientPool(self.mc, 2)
        with p.reserve() as smc1:
            with p.reserve() as smc2:
                self.assertRaises(Queue.Empty, p.reserve().__enter__)