Beispiel #1
0
 def test_cluster_client(self, app):
     url = "rediscluster://123.123.123.123:3636//1"
     Backend = backends.by_url(url)
     assert Backend is redis.CacheBackend
     backend = Backend(app, url=url)
     assert isinstance(backend, redis.CacheBackend)
     client = backend._new_client()
     assert isinstance(client, aredis.StrictRedisCluster)
     pool = client.connection_pool
     assert {"host": backend.url.host, "port": 3636} in pool.nodes.startup_nodes
Beispiel #2
0
 def test_single_client(self, app):
     url = 'redis://123.123.123.123:3636//1'
     Backend = backends.by_url(url)
     assert Backend is redis.CacheBackend
     backend = Backend(app, url=url)
     assert isinstance(backend, redis.CacheBackend)
     client = backend._new_client()
     assert isinstance(client, aredis.StrictRedis)
     pool = client.connection_pool
     assert pool.connection_kwargs['host'] == backend.url.host
     assert pool.connection_kwargs['port'] == backend.url.port
     assert pool.connection_kwargs['db'] == 1
Beispiel #3
0
 def _new_cache_backend(self) -> CacheBackendT:
     return cache_backends.by_url(self.conf.cache)(self,
                                                   self.conf.cache,
                                                   loop=self.loop)