The way you wrote it lets you easily plugin different "storage backends", you might then benchmark locally the difference between, say, a File Storage backend and a Redis backend or a DBMS backend.
It could be interesting to find out which is faster for this use case ;-)
If I'm stuck again inside a boredom trip, I may do it !
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.