Depends on the device and the environmental cause. In general you should not be using a device not fit for that environment to the point where excessive corrosion occurs, OR simply plan on a periodic replacement.
There are some design choices such as use gold plating, seal all wire connections, use a conformal coating. Use a weatherproof housing, temperature and humidity control the area, MOST IMPORTANTLY, construct a pyramid shaped impenetrable barrier out of silica gel, with an outer skin of unobtanium, housing an internal HVAC system.
A better question is why do you have OCD about things lasting *forever*? Normally, electronic equipment failure is not due to corrosion, providing it is used in its intended environment.
Seems like you were already recommended to use an air conditioner in general, to solve many problems including your own comfort.