Pinoy Webmaster
.com pimp
Gender:
Posts: 1126
6048 credits Members referred : 0
Philippine Beaches
« Reply #5 on: Apr 28, 2007, 03:00:11 AM »
does cached files overwrite itself or a new file is added everytime the old one expires thereby taking up storage space so there is a need to delete them from time to time?
does cached files overwrite itself or a new file is added everytime the old one expires thereby taking up storage space so there is a need to delete them from time to time?
the name of the cached file is still the same, script looks after the last modfied date, will say there is only one file for each url, yes right if you have 100.000 urls there are 100.000 cache files
Where are my glasses?
Posts: 21
138 credits Members referred : 0
« Reply #9 on: Jul 20, 2007, 01:43:58 AM »
I was looking two days for the best method to cache contents. For plain data I'd use file_get_contents() and file_put_contents(). For caching loops I can recommend SQLite. It has the best performance to read out big data in a short period of time. I posted the full story at http://phpperformance.de/ausgaben-in-cache-speichern/ (last comment). Unfortunately it's in German.
I am a metal monkey!
Administrator Community Supporter?
Jedai Sword Master
Gender:
Posts: 8037
41179 credits Members referred : 3
Where are my glasses?
Posts: 21
138 credits Members referred : 0
« Reply #11 on: Jul 20, 2007, 01:54:37 AM »
The MySQL table consists of 1.000.000 records but I did only read out 20.000 of them. I had a performance boost of ~500%.
Global Moderator Community Supporter?
Jedai Sword Master
Gender:
Posts: 6309
38674 credits Members referred : 374
It's time to use PHP5!
« Reply #12 on: Jul 20, 2007, 09:30:28 AM »
Makes sense since sqllite is file based too.
At the moment that I started this thread the directory with cached file becomes bigger than 100.000 files.
this amount was not a problem, later I decided to create a cronjob to remove files older than a week. This job is holding the amount of files near the 100.000 files and I'm happy with that.
but anyway using sqllite for caching sound interesting.
Tim do you checked also the filsize for the database is this bigger smaller than for the file based cache?
how about the server load while reading some file/record?
Where are my glasses?
Posts: 21
138 credits Members referred : 0
« Reply #13 on: Jul 20, 2007, 03:55:29 PM »
Maybe it would be better if you check the creation time of the caching file before every usage. Then consider deleting it if it's older than one week, refresh the RSS newsfeed and rewrite the cache or use the data of the cache.
I haven't yet used my caching method in production use but I don't think the server load would be much higher than by using ordinary files. As I've already said, this method is high recommendable if you need to cache loops because you can't jump between records with fseek()/ftell()/fgets() as fast as you can with SQLite . I didn't find any better solution being based on files. Another solution would be to create a second MySQL server which runs at another port instead of using SQLite. Does MySQL have a better performance than SQLite?
I am a metal monkey!
Administrator Community Supporter?
Jedai Sword Master
Gender:
Posts: 8037
41179 credits Members referred : 3
« Reply #14 on: Jul 20, 2007, 03:59:05 PM »
Of course mysql has better performance. SQLite is good for small databases, and besides that I don't know how it will handle many concurrent connections (while the file system and mysql will be ok with this)