Posts: 3,621
Name: Thierry
Location: I'm the uber Spaminator !
|
Usually, except when you are starting to have a lot of query sent for a page, caching is not the good answer.
A query can be so badly written, than it will need 4/5 seconds to run.
Of course, caching, in this case, limit the number of time the bad query is fired, but not why it takes so long.
You cure the effects, but not the cause.
I have used a caching mechanism like your for a site I worked on some years ago.
But we where around 8Go of data transfer per days, and around 60 queries per seconds when we implemented the caching mechanism.
We already had optimized the queries by that time.
But otherwise, your caching mechanism looks ok.
You might want to take a look on memcache, as it's especially designed to hold a record in the form [key]=[value] for a time that can be specified.
This let the stored key became invalid after a given time, without the need for you to delete the file from the server.
__________________
Only a biker knows why a dog sticks his head out the window.
|