To prevent future infestations:
Keep food storage areas clean and dry.
Do not leave fresh food after opening or after you have taken a bite out of it.
Remember to take out your trash regularly and clean up any spills inside or on top of trash cans.