Caffeine and other compounds could prevent dementia and other neurodegenerative disorders, according to a new study.