ASP NET CORE - Use Session to store lists to prevent BD access

Asked

Viewed 33 times

-1

Essa é a print de uma das tablesI have little experience in web applications and I have this question. I am developing an application in ASP NET CORE 3.1, that in one of the pages I have 5 Tables (BOOTSTRAP) that are filled by queries to the BD that searches all the records of a given establishment for each Table, from where part the system CRUD.

It turns out that with every round to this page these queries are made again to refresh the page, thus causing slowness and many requests to BD.

I thought about using Session to store these lists, but I’ve seen some criticism about using Session. So I would like help to try to find a solution that does not hurt good practices on the Web.

  • I solved my need by using Sesssion

1 answer

0

Dude, what you should do is find a component for your front that manages the display of the backend data. A "datatable on Steroids". Then you call your data get API and it displays the top 10 while still downloading the rest. Now if the doubt is to leave the page and return to it again, it is natural to search again in DB. If you do not want this to happen, you can configure the endpoint cache of your Apis, so that queries made within a certain time, do not pass the controller, and always use the previously obtained result.

  • Do you have any example of what this Endpoint cache configuration would look like?

Browser other questions tagged

You are not signed in. Login or sign up in order to post.