Ejemplo n.º 1
0
 def test_lazyRedisConnectionPool(self):
     # lazyRedisConnection returns RedisAPI
     rapi = txredisapi.lazyRedisConnectionPool(redis_host, redis_port, pool_size=2)
     self.assertEqual(isinstance(rapi, api.RedisAPI), True)
     yield rapi._connected
     disconnected = yield rapi.disconnect()
     self.assertEqual(disconnected, True)
Ejemplo n.º 2
0
 def test_lazyRedisConnectionPool(self):
     # lazyRedisConnection returns RedisAPI
     rapi = txredisapi.lazyRedisConnectionPool(redis_host,
                                               redis_port,
                                               pool_size=2)
     self.assertEqual(isinstance(rapi, api.RedisAPI), True)
     yield rapi._connected
     disconnected = yield rapi.disconnect()
     self.assertEqual(disconnected, True)
Ejemplo n.º 3
0
 def __init__(self):
     handlers = [
         (r"/(.*)", MainHandler),
     ]
     settings = dict(
         cookie_secret="32oETzKXQAGaYdkL5gEmGeJJFuYh7EQnp2XdTP1o/Vo=",
         mongo=txmongo.lazyMongoConnectionPool(),
         redis=txredisapi.lazyRedisConnectionPool(),
         template_path=os.path.join(os.path.dirname(__file__), "templates"),
     )
     cyclone.web.Application.__init__(self, handlers, **settings)
Ejemplo n.º 4
0
def create_application():
    rd = txredisapi.lazyRedisConnectionPool()
    redisBackend = RedisResolverBackend(rd, servers=[('8.8.8.8', 53)])

    application = service.Application("txdnsredis")
    srv_collection = service.IServiceCollection(application)

    dnsFactory = server.DNSServerFactory(caches=[cache.CacheResolver()],
                                         clients=[redisBackend])

    internet.TCPServer(53, dnsFactory).setServiceParent(srv_collection)
    internet.UDPServer(
        53,
        dns.DNSDatagramProtocol(dnsFactory)).setServiceParent(srv_collection)
    return application
Ejemplo n.º 5
0
Archivo: web.py Proyecto: gleicon/docdb
def main():

    db = txredisapi.lazyRedisConnectionPool(pool_size=10)
    oper = core.DBOper(db)

    settings = {
        "db": db,
        "oper": oper
    }
    
    application = cyclone.web.Application([
        (r"/docdb/(\d+)?", MainHandler),
        ], **settings)


    reactor.listenTCP(8888, application)
    reactor.run()
Ejemplo n.º 6
0
    def doStart(self):
		self.client = txredisapi.lazyRedisConnectionPool()
		log.msg('Redis Client initialized ', self.client)
Ejemplo n.º 7
0
 def load(self):
     self.api = txredisapi.lazyRedisConnectionPool("127.0.0.1",6379, pool_size=2)