Running a database on your current server probably is the best option. I wondered that because you state "very fast" in your title. And when I read on, you uee file IO. And it contradicts so much that I can't stop wonder.
Sadly, it's currently on a small server I have no root control on, and which doesn't have a lot of storage space.
Still, good point
We’re a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.