Cache Duration In Yii


After a few months developing with Yii mi website finally went live! :rolleyes:

I was really worried that my db didn’t handle well all the visits that we could have (we have around 15000 visitors per day, mostly between 8 and 10pm) so I decided to put a lot of caching in my App!

All cache was set for 1 week and was invalidated depending on the last update time of my models.

My caching was working really well when I was testing it on the development platform, but now on the live website it seems to slow down the execution of the pages.

I have a lot of pages (I think around 500 000) and I thought that since all the generated caches are stored in the same folder yii could take some time to retrieve the cache files since there must be millions of them.

Is my assumption good?

If it is could you tell me a cache duration that would be appropriate for my website?

Thanking you in advance!

Edit: To complete my post, I’m using CFileCache!

I found the answer of my question: Yes many cache files can slow down the execution of the cache. But Yii CFileCache class has a built in feature to create several folders for cache by setting the attribute directoryLevel to something higher than 0.

I also set the cache to One day and not one week, I’m going to see during tomorrow rush if everything is now behaving as expected!!