Preheat oven to 300°F Spread the cashews on a baking sheet and roast until golden, shaking the pan occasionally. Set aside.
Heat a wok over medium heat. Add oil and swirl to coat the pan. Turn heat up to high and add the onion, carrots and ginger if using. Sprinkle with salt and stir-fry until carrots start to become tender.
Toss in garlic and red pepper pieces and continue to cook for about another 5 minutes. Add vinesgar and soy sauce and cook for another couple minutes. Add the red pepper flakes and serve garnished with cashews and pineapple if using. Can serve warm or hot.