This means an extra DB call taking up a connection slot and using time for handling the request.
Since ID/Username mapping never changes we can have an incredibly naive caching in memory with a map of userIds<string,int> that we fill up on startup / adding users.
Then we can check that first and only do db call in case we don't have it in cache.
We have a lot of calls mapping id and username
userid, := db.Get_user_id(username)
This means an extra DB call taking up a connection slot and using time for handling the request.
Since ID/Username mapping never changes we can have an incredibly naive caching in memory with a map of userIds<string,int> that we fill up on startup / adding users. Then we can check that first and only do db call in case we don't have it in cache.