Preheat the oven to 350 degrees F.
Lightly grease a shallow 9 by 13-inch gratin dish. Arrange the cardoons in a single layer at the bottom of the pan. Sprinkle 1/4 cup grated caciocavallo, 1/4 cup grated pecorino, bread crumbs and parsley over the cardoons and top with anchovies, diced caciocavallo and diced pecorino.
Season, to taste, with the salt and pepper. Add 3 tablespoons olive oil and toss until well combined.
Drizzle the top with the remaining 1 tablespoon of olive oil. Place in the oven and bake until the top is golden brown, about 25 minutes. Serve hot with a squeeze of lemon.