r/SpringBoot • • Nov 10 '24

Java, Spring Boot Developer Help Available For Free

Hi
I have close to 3+ YOE in Java, Spring Boot and I'm looking for something interesting to get my hands on for learning new cool things. I'm available to work for free, So if anyone is building anything interesting and need a hand. Hit me up.

49 Upvotes

37 comments sorted by

View all comments

Show parent comments

1

u/glonk_03 Nov 10 '24

I don't know redis in detail but I see that while inserting a new user you are checking if an user already exists with the same username and if present you are throwing an exception which means that the username will be unique for each entries, why can't you use username as the cache-key ?

Is there any reason to have a getByUserId and getByUserName as two different ways to get users as the userId is something generated by your DB Sequence and it is not meaningful to anyone consuming the apis, since they have to store it somewhere if they want to use the getByUserId API later.

So my question is why can't you have the username as the cache-key and only one API to get the user i.e. using username.

-2

u/Ashutosh_Rajput Nov 10 '24

no this is different project. I provided it if want to help in this but problem is from different project.