Virtual Happy Hour this month, Jun 28, we'll be getting a sneak preview at our soon to launch SaaS CMS!

Try our conversational search powered by Generative AI!

Caching of database data



I am creating custom visitor group criteria for visited pages. I am saving the visitors information of visited pages based on visitor group criteria in my custom database for example(PageName,Last Visited,No of visits) etc. I will track these users based on cookie and database.

For each visitor I will require to go at server side, check IsMatch for visitor criteria (for that read database information of that user), if criteria matches make an entry in database will be time consuming and will slow down my website.

I want to somehow cache the user information from database at specific point of visitor visit to website(I am not sure which point as I am trying to avoid call during start page).

Which approach will be good architecture point of view regading such a scenario.

Thanks in advance.

Best Regards,

Sanket Mahimkar

Nov 02, 2016 14:30

If possible, implement the IsMatch method based on rules rather than database calls?
If not, store result of call in session and work vs that instead for future calls with the same user? Will take some memory which might or might not be a problem...
One or two db calls extra per request is bad. One per new session is ok normally...

To store new information based on what the user does I guess this is a fire and forget call. Then you can do that asynch for instance by using threading or you can save a queue in memory somewhere of calls you want to make to the db and then have a separate task that uses the queue and updates it every 5 minutes or something. Then you can use batch calls vs db which are cheap. Google bulkinsert for EF for example...

Something like that...

Nov 02, 2016 15:33
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.