Epilepsy and dementia link?

i’ve been reading about the potential link between epilepsy and dementia, and i’m wondering if anyone else has come across this. my doc mentioned that people with epilepsy are at a higher risk of developing dementia, but i haven’t found much info on what that actually means.

is it just a correlation or is there something more going on? i’ve been trying to wrap my head around it, but it’s hard to find concrete answers.

does anyone have any experience with this or know of any studies that might shed some light? i’m kinda curious about the mechanisms behind it, like is it related to the frequency of seizures or something else entirely?