DEV Community

Discussion on: Your thoughts on Creating a New User

Collapse
 
fcpauldiaz profile image
Pablo Díaz • Edited

What if you have a service that allows to be used without user creation and only if you want to store the results, you can then create the user? How can that be handled? Keep the info generated in memory? Use Redis?

Collapse
 
pedro profile image
Pedro M. M. • Edited

If you want to store results and the user is not logged in or there is no user yet I would recommend you to store everything in a local cache, i.e the client. For example, on a website I would use localstorage. Then all you need is to sync it with the server as soon as he logs in.

Probably I would never use server side to store anything related to non-logged users since there are no guarantees on the user uniqueness, but it depends on the situation. That said, you could store non-logged users data on server side once, but trying to retrieve this data from/for the same non-logged user is probably not a good idea since we can’t ensure he is the same person :)

Collapse
 
fcpauldiaz profile image
Pablo Díaz

Nice approach 😎

Collapse
 
jessachandler profile image
Jess Chandler

Good questions, Pablo. That seems like a whole other can of worms. Maybe you create a temporary user in a separate database to not muckup your user database that is based only on their IP address and timestamp or something...or issue them a token that when they first start interacting with the site? I am just guessing.