For example game has button which logged in user clicks. I want to store these clicks in memory on server so user won't skip them, and after 10 clicks give user button to save them to a database
I was thinking about using session variables. Is it good practice to use session variables for this kind of task?
Or is memory cache a better way to approach this?
Or will I have to use distributed memory cache like Redis for this?
Caching is definitely not the way to do it, as it is made to optimize connections with external systems or reduce the number of identical heavy operations.
Using a session variable is a good easy way to do this, better than most in-memory solutions even as a session is automatically invalidated when the session ends, which seems to be what you want to achieve.
I haven't worked much with session variables but the docs explain it nicely: https://learn.microsoft.com/en-us/aspnet/core/fundamentals/app-state