Example #1
0
    async def _set_indexes(ctx: object, db: AioRedis):
        """
        sets secondary indexes

        @param ctx: indexess to set
        @param db: redis instance
        """
        coroutines = []
        for index in [('status_code', rule_status_code_index),
                      ('service_id', rule_service_id_index)]:
            if index[0] in ctx:
                coroutines.append(db.hset(index[1], ctx['_id'], ctx[index[0]]))
        for index in [('rule_id', entry_rule_id_index),
                      ('host', entry_host_index)]:
            if index[0] in ctx:
                coroutines.append(db.hset(index[1], ctx['_id'], ctx[index[0]]))
        await Async.all(coroutines)
Example #2
0
    async def _set_indexes(ctx: object, db: AioRedis):
        """
        sets secondary indexes

        @param ctx: indexess to set
        @param db: redis instance
        """
        coroutines = []
        for index in [('service_id', endpoint_cache_service_id_index)]:
            if index[0] in ctx:
                coroutines.append(db.hset(index[1], ctx['_id'], ctx[index[0]]))
        await Async.all(coroutines)