async def clear_user_permission_cache_for_org( cls, redis: utils.RedisCache, user: github_types.GitHubAccount) -> None: pipeline = await redis.pipeline() async for key in redis.scan_iter( f"{cls.USERS_PERMISSION_CACHE_KEY_PREFIX}{cls.USERS_PERMISSION_CACHE_KEY_DELIMITER}{user['id']}{cls.USERS_PERMISSION_CACHE_KEY_DELIMITER}*" ): await pipeline.delete(key) await pipeline.execute()
async def clear_team_permission_cache_for_team( cls, redis: utils.RedisCache, owner: github_types.GitHubAccount, team: github_types.GitHubTeamSlug, ) -> None: pipeline = await redis.pipeline() async for key in redis.scan_iter( f"{cls.TEAMS_PERMISSION_CACHE_KEY_PREFIX}{cls.TEAMS_PERMISSION_CACHE_KEY_DELIMITER}{owner['id']}{cls.TEAMS_PERMISSION_CACHE_KEY_DELIMITER}*", count=10000, ): await redis.hdel(key, team) await pipeline.execute()