I had a quick look at the code to understand what (sort of) meant. It's appending to a file and then reading it back and looking for the key line by line so it's O(n). I'm not sure about redis internals but I imagine its using some search tree for saving to disk which will likely be O(log n). So in a benchmark with more data redis should win by exponential margins. Ofc if you are only storing 100s of keys then this is a good approach.