20.03.2013, 15:16
I think more people need to ****** what cache exactly is, and why they shouldn't spam database with unnecessary queries. Think - if someone wants to take your server down, all he has to do is spam some function which calls database over and over again.
What you have to do to prevent it?
1. Load data earlier and store it in some array
2. Update data periodically with some timer (for example every 5 minutes)
3. When someone asks about that data, give him answer from your cache, DO NOT send another query
What you have to do to prevent it?
1. Load data earlier and store it in some array
2. Update data periodically with some timer (for example every 5 minutes)
3. When someone asks about that data, give him answer from your cache, DO NOT send another query