Esempio n. 1
0
async def startup() -> None:
    logger.debug("In startup")
    # await database.connect()

    redis = await aioredis.create_redis_pool(settings.cache_url,
                                             encoding="utf-8")
    FastAPICache.init(RedisBackend(redis),
                      prefix="api-cache",
                      coder=PydanticCoder)
Esempio n. 2
0
async def startup():
    update_loggers()

    redis = aioredis.from_url(config.REDIS_HOST,
                              encoding="utf8",
                              decode_responses=True)
    FastAPICache.init(RedisBackend(redis), prefix="fastapi-cache")

    logger.info("initialization successful")
Esempio n. 3
0
async def startup():
    """Start up FastAPI server"""
    settings = get_settings()
    app.state.graph = TccmGraph(settings)
    app.state.graph.connect()
    redis = aioredis.from_url(url=settings.redis_url,
                              encoding="utf8",
                              decode_responses=True)
    FastAPICache.init(backend=RedisBackend(redis), prefix="fastapi-cache")
Esempio n. 4
0
async def startup():
    redis = await aioredis.create_redis_pool(os.getenv("REDIS_URL", "redis://localhost"), encoding="utf8")
    FastAPICache.init(RedisBackend(redis), prefix="fastapi-cache")
Esempio n. 5
0
async def startup():
    await database.connect()
    redis = await aioredis.create_redis_pool(
        "redis://*****:*****@127.0.0.1:63790/2", encoding="utf8")
    FastAPICache.init(RedisBackend(redis), prefix="fastapi-cache")
Esempio n. 6
0
async def startup():
    redis = aioredis.from_url(url="redis://localhost")
    FastAPICache.init(RedisBackend(redis), prefix="fastapi-cache")
Esempio n. 7
0
async def handle_startup():
    """Setup redis cache and client session for weather API requests"""
    redis = await aioredis.create_redis_pool(settings.REDIS_URL,
                                             encoding="utf8")
    FastAPICache.init(RedisBackend(redis), prefix="weather-app-cache")
    app.client_session = aiohttp.ClientSession()