Answer the question
In order to leave comments, you need to log in
Correct output of values from the database?
Hello!
The page displays information about the user (login, avatar and other static information is stored in the session), but the question arose, how to display the balance?
If you display it simply by taking it from the database, then will it not fall, say, with 1k+ online, which update the page quite often?
There was an option to save in the session and make a refresh button, when clicked, a request is sent to the database and resaved to the session, but it does not fit.
The same question, for example, to the blog. The user opens a page with records and they are loaded directly from the database? Or are they stored somewhere and removed from there?
And the last question: for example, on the main page there is a balance, entries from the blog, entries from other "modules". And remove them all from the database? Same for 1 page at least 10 requests
Thanks in advance for your replies. If this is a stupid question, then don't throw stones.
Answer the question
In order to leave comments, you need to log in
You can use memcached and cache the user's balance in it using the "$uid.balance" key, for example. And when changing the user's balance, delete the value by key.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question