3
good afternoon.
I have an application that has a whole level of permissions management of access to pages and a number of other settings.
Whenever a user authenticates, I assemble a list of all the menus (links/pages) that this user can access on the system. What happens is that at this moment (approval of the latest version) the list is being populated with each request/refresh of a page. What I want is to know if you have any way to store this in something I can query whenever I need, without the need to go in the database.
So far I have used (attempts):
- Session: works, but I don’t like to use, even more that the application has a daily volume of +10k people;
- Userdata do Formsauthentication: I tried to convert a viewModel to Javascriptserialization, but as the size became huge, it was not created and the cookie was not generated;
- Actionresult Outputcache: This method was one of my favorite ones, but it is not specific to each session/login, but rather to the application as a whole;
I hope you can help me, because for a long time I’ve been racking my brain to think of this solution.
Hugs!
I got it. I didn’t know about Redis yet. But as for the 3 items I quoted above, only Session worked, but no one recommends using it, so I’m pretty much out of the woods yet...
– Antônio Filho
That’s why. Redis functions as a session mechanism, whose keys can be exploited. You instantiate a value having as key some user identification and expires this value after a certain time. Since Redis is a great dictionary (value-key), you can put anything in the value, including HTML and JSON, if you wish.
– Leonel Sanches da Silva
then I can make a "Redis["test"]. Value = listMenu (List<Menu>)"? And it also expires like a Session?
– Antônio Filho
You can. Yes, it expires the same Session. You can manually expire if you want.
– Leonel Sanches da Silva
I’m sorry to ask, but what do I get by using Redis instead of Session?
– Antônio Filho
It is isolated from the normal Session engine, which has a classic balancing problem; As simple to use as normal Session; You can use Redis as a cache of anything, and not only of Sessions, but also of data that does not change much.
– Leonel Sanches da Silva