Good morning.
I will write as specific as possible.
I want to make a notification system which will inform users that an application has been answered. I use PHP without framework and Mysql.
I can create a table to save and update the current number of requests of each user, that each time a request is answered the number associated with the number of requests of that user increase and when consulting the database through ajax opt the number to be compared with a count of the user generated request tables.
The other option is to create a file json obviously not consult the database, the idea of this is that when you are responding requests see and write the file json associated with this user.
The file would have an array that contains the user name, current number of requests, new quantity, etc. When the user clicks on the notifications icon, the file is updated and the number of new requests will be the same as the current one and will not notify him until the process is repeated.
Finally my question is that it would be more efficient?
Note: The system currently has more than 300 simultaneous users connected, I also know how to do the two options although I am open to other alternatives.
Note2: It is a system that is in a closed network so I can not depend on external services.