Think of your application logic as the following 3 layers :
MySQL acts as a permanent persistent data store for your app while Redis acts as a proxy between your Application Code and MySQL store. When you are calling getUserdetails() , you should first check in the Redis to see if there is any data already cached. You can check this by using EXISTS command in Redis. If a particular key exists, it means the data is cached. So, you should just go ahead and fetch it and send it to the user. Otherwise you should hit the MySQL DB, fetch data & serve the user and then store it in Redis for future access. You can also set a expiry time while storing a key in Redis in which case the key will be deleted after the specific period.
Let me know if you need more help!