As of version 1.10 food no longer last indefinitely. Here's some ways on how to increase the life time of all your sustenance
Any completely enclosed space is recognized by the game as a cellar and will increase the shelf life of all your food items. To maximize the effect:
- Build your walls from solid soil, brick or stone materials
- Keep door count low. The best is no doors.
- Keep the sun light level inside the cellar low. Artificial lights are okay.
- Cellars should be no bigger than 6x6x6 blocks, bigger than that and it might not get recognized as a cellar
Once you have a cellar you can place any food either on the ground (those that are placeable) or inside containers. All of them will receive the same benefit equally. You can verify that benefit by looking at the block info HUD. It will display something in the likes of
Stored food perish speed: 0.24 - which in this case means food will last about 4 times longer.
Meals and Pickled vegetables can be stored in crocks which on its own gives a slight bonus, but when sealed with a piece of fat increases shelf life by a factor of 10! Combine the filled crock with a piece of fat inside your crafting grid to get that effect.
For convenience you can build shelves that can hold up to 8 crocks at a time.
The climate in the place you live in has an effect on the foods rate of spoilage. Hot climates greatly increase it (up to 2.5x), while very cold greatly decreases it (up to 0.1x). Only the climate at sea level is considered, so placing your food high up in the mountain will have no effect.
You can however completely negate the impact of a warm climate by building a cellar.
Food specific bonuses
Berries can either be stored as part of a meal or by making Jam. See cooking page on how to make jam
Vegetables and Beans
Raw Carrots, Turnips, Parsnips and Cabbage can be pickled in a barrel together with saltwater which greatly improves their shelf life. Picking Onions yields in a light improvement, whereas Soybeans are best stored dry. To make salt water you'll have to acquire salt either from traders or from rare salt deposits. In desert areas one might be able to find dried up salt lakes close to the surface or you can go search for massive salt domes which are detected by the prospecting pick.
Vegetables that you cannot pickle or cook right away are best stored raw inside a Storage vessel inside a Cellar.
Grain is best stored as it is inside a Storage Vessel inside a Cellar.
The best option for storing meat is to cure it in the barrel with salt, but also keeping it as a part of a meal inside sealed crocks is a good option.
Food preservation benefits stack, so its best to combine as many preservation methods as possible. Example: Cooked turnips inside a sealed crock inside a fully enclosed cellar.