Data caching

Hi there,

I am caching my data into a file. Everytime there is an addititional entry, it goes and get written into that file.

I wanted to see if it was the best way to cache data, as it will avoid lots of queries into a table that will be hold thousands of data.

Does anybody can help in that situation??

PS: what is the best solution to update that cache file?
eg. delete line and append new into file??

Thanks for any help,