Preheat the oven to 350°F (175°C) and grease two 9-inch round cake pans.
In a medium bowl, sift together the flour, baking powder, baking soda, salt, cinnamon, nutmeg, and ginger.
In a large bowl, whisk together the sugar and vegetable oil. Add the eggs one at a time, whisking after eachaddition. Stir in the vanilla extract.
Add the dry ingredients to the wet ingredients in two batches, mixing until just combined. Stir in the gratedcarrots, chopped walnuts, and raisins, if using.
Divide the batter evenly between the two prepared cake pans.
Bake for 25-30 minutes or until a toothpick inserted in the center comes out clean.
Remove the cakes from the oven and let cool in the pans for 10 minutes before transferring them to a wirerack to cool completely.
To make the cream cheese frosting, use an electric mixer to beat the cream cheese and butter together untilcreamy. Add the confectioners' sugar and vanilla extract and beat until smooth and creamy.
Once the cakes have cooled completely, place one cake layer on a serving plate and spread a layer of creamcheese frosting on top. Place the second cake layer on top and frost the top and sides of the cake with theremaining frosting