Designing a web service that uses a login and keeps all user data and passwords in memory (does not use any database) have raised doubts when it comes to ensuring a decent level of efficiency:
First, what data structure to choose to save this information. While I think that a HashMap
would be a good option, where the usernames would be the keys and the rest of the information (or just the password) would be the values, I would like to know if there are other data structures that fit better.
Also, in the specific case of HashMap
, would it be better to use separateChainnig
or LinearProbing
as a conflict resolution strategy? In the case of separateChaining
we are faced with one of the lists of the "holes" of the hashMap was very long and the complexity was linear order in the worst case, but with LinearProbing
could be many rehashes.
What do you think?